remove lib2d

This commit is contained in:
侯歌 2024-05-20 09:05:10 +08:00
parent abbdbf98ae
commit e587d51b92
112 changed files with 0 additions and 60510 deletions

View File

@ -27,8 +27,6 @@ endif()
list(APPEND TINAT113_INCLUDE_DIRS ../common)
list(APPEND TINAT113_INCLUDE_DIRS ../include)
add_subdirectory(lib2d)
link_directories(${PROJECT_SOURCE_DIR} ./lib2d)
include_directories(./
../common ../include
${CMAKE_SOURCE_DIR}/src/gui/

View File

@ -1,45 +0,0 @@
project(ingenic2d C CXX)
set(G2DSRCS
src/lib/os/gc_hal_user_debug.c
src/lib/os/gc_hal_user_math.c
src/lib/os/gc_hal_user_os.c
src/lib/user/gc_hal_user_brush.c
src/lib/user/gc_hal_user_brush_cache.c
src/lib/user/gc_hal_user_dump.c
src/lib/user/gc_hal_user.c
src/lib/user/gc_hal_user_raster.c
src/lib/user/gc_hal_user_heap.c
src/lib/user/gc_hal_user_query.c
src/lib/user/gc_hal_user_rect.c
src/lib/user/gc_hal_user_buffer.c
src/lib/user/gc_hal_user_surface.c
src/lib/user/gc_hal_user_queue.c
src/lib/hardware/gc_hal_user_hardware_blt.c
src/lib/hardware/gc_hal_user_hardware_clear.c
src/lib/hardware/gc_hal_user_hardware_context.c
src/lib/hardware/gc_hal_user_hardware_filter_blt_de.c
src/lib/hardware/gc_hal_user_hardware_filter_blt_vr.c
src/lib/hardware/gc_hal_user_hardware.c
src/lib/hardware/gc_hal_user_hardware_pattern.c
src/lib/hardware/gc_hal_user_hardware_pipe.c
src/lib/hardware/gc_hal_user_hardware_primitive.c
src/lib/hardware/gc_hal_user_hardware_query.c
src/lib/hardware/gc_hal_user_hardware_source.c
src/lib/hardware/gc_hal_user_hardware_target.c
src/lib/ingenic2d.c
)
include_directories(
include/
include/lib2d
src/lib/hardware
src/lib/include
src/lib/os
src/lib/user)
set(INGENIC_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include/lib2d PARENT_SCOPE)
add_library(ingenic2d STATIC ${G2DSRCS})
link_directories(./)
#target_link_libraries(ingenic2d hardware2 m)

View File

@ -1,9 +0,0 @@
menuconfig APP_lib2d
bool "lib2d (2d 硬件加速模块接口)"
default n
config APP_ingenic2d_cmd
bool "2d shell 命令"
default y
endmenu

View File

@ -1,210 +0,0 @@
#ifndef __INGENIC2D_H__
#define __INGENIC2D_H__
/*2d 操作句柄*/
struct ingenic_2d;
/*2d格式暂时不支持planer的格式目标格式不支持yuv格式*/
enum ingenic_2d_format {
INGENIC_2D_ARGB8888,
INGENIC_2D_RGB565,
INGENIC_2D_XRGB8888,
INGENIC_2D_YUYV422,
INGENIC_2D_UYVY422,
};
/*旋转角度枚举*/
enum ingenic_2d_rotate_angle {
ROTATE_0,
ROTATE_90,
ROTATE_180,
ROTATE_270,
};
/*2d数据源以及目标数据的描述帧*/
struct ingenic_2d_frame {
int width; /*用户申请的宽*/
int height; /*用户申请的高*/
int align_width; /*2d模块实际操作的宽目前测到的分辨率暂时都不需要对齐暂时先保留*/
int align_height; /*2d模块实际操作的高目前测到的分辨率暂时都不需要对齐暂时先保留*/
int stride; /*一行大小(字节)*/
int frame_size; /*一帧大小(字节)*/
void *addr[3]; /*帧数据虚拟地址暂时不支持plane的格式所以暂时只需使用[0]地址*/
unsigned int phyaddr[3]; /*帧数据物理地址暂时不支持plane的格式所以暂时只需使用[0]地址*/
enum ingenic_2d_format format; /*帧格式*/
};
/*功能性api的操作矩形包含了实际操作的有效区域以及帧描述*/
struct ingenic_2d_rect {
int x; /*有效区域的水平起始位置*/
int y; /*有效区域的垂直起始位置*/
int w; /*有效区域的宽度*/
int h; /*有效区域的高度*/
struct ingenic_2d_frame *frame; /*数据描述帧*/
};
/*描述一线的结构体,两点描述一线*/
struct ingenic_2d_line {
int x0,y0; /*第一个点的坐标*/
int x1,y1; /*第二个点的坐标*/
};
/**
* @brief 2d设备句柄
* @param NULL
* @return 2d句柄,NULL
*/
struct ingenic_2d *ingenic_2d_open(void);
/**
* @brief 2d设备句柄
* @param ingenic_2d 2d设备句柄
* @return
*/
void ingenic_2d_close(struct ingenic_2d *ingenic_2d);
/**
* @brief 2d操作矩形
* @param frame 2d帧描述
* @param x
* @param y
* @param w
* @param h
* @return NULL
*/
struct ingenic_2d_rect ingenic_2d_rect_init(struct ingenic_2d_frame *frame,
int x, int y, int w, int h);
/**
* @brief 2d帧描述()
* @param ingenic_2d 2d设备句柄
* @param width
* @param height
* @param format
* @return NULL
*/
struct ingenic_2d_frame *ingenic_2d_alloc_frame(struct ingenic_2d *ingenic_2d,
int width, int height,
enum ingenic_2d_format format);
/**
* @brief 2d帧描述()
* @param ingenic_2d 2d设备句柄
* @param width
* @param height
* @param format
* @param phyaddr
* @param addr
* @param addrsize
* @return NULL
*/
struct ingenic_2d_frame *ingenic_2d_alloc_frame_by_user(struct ingenic_2d *ingenic_2d,
int width, int height,enum ingenic_2d_format format,
unsigned long phyaddr, void *addr, int addrsize);
/**
* @brief 2d帧描述 2d帧结构体
* @param ingenic_2d 2d设备句柄
* @param width 2d帧描述
* @return
*/
void ingenic_2d_free_frame(struct ingenic_2d *ingenic_2d, struct ingenic_2d_frame *frame);
/**
* @brief
* @param ingenic_2d 2d设备句柄
* @param angle
* @param src
* @param dst
* @return 0
*/
int ingenic_2d_rotate(struct ingenic_2d *ingenic_2d,
enum ingenic_2d_rotate_angle angle,
struct ingenic_2d_rect *src,
struct ingenic_2d_rect *dst);
/**
* @brief
* @param ingenic_2d 2d设备句柄
* @param src
* @param dst
* @return 0
*/
int ingenic_2d_scale(struct ingenic_2d *ingenic_2d,
struct ingenic_2d_rect *src,
struct ingenic_2d_rect *dst);
/**
* @brief
* @param ingenic_2d 2d设备句柄
* @param dst
* @return 0
*/
int ingenic_2d_fill_rect(struct ingenic_2d *ingenic_2d, struct ingenic_2d_rect *dst, int color);
/**
* @brief
* @param ingenic_2d 2d设备句柄
* @param src
* @param dst
* @param global_alpha
* @return 0
*/
int ingenic_2d_blend(struct ingenic_2d *ingenic_2d,
struct ingenic_2d_rect *src,
struct ingenic_2d_rect *dst, int global_alpha);
/**
* @brief 线
* @param ingenic_2d 2d设备句柄
* @param lines 线
* @param line_count 线
* @param line_color 线
* @return 0
*/
int ingenic_2d_draw_lines(struct ingenic_2d *ingenic_2d,
struct ingenic_2d_rect *dst,
struct ingenic_2d_line *lines, int line_count, int line_color);
/**
* @brief
* @param ingenic_2d 2d设备句柄
* @param src
* @param dst
* @param x_filp 使
* @param y_filp 使
* @return 0
*/
int ingenic_2d_filp(struct ingenic_2d *ingenic_2d,
struct ingenic_2d_rect *src,
struct ingenic_2d_rect *dst,
int x_filp, int y_filp);
/**
* @brief
* @param ingenic_2d 2d设备句柄
* @param src
* @param dst
* @return 0
*/
int ingenic_2d_convert(struct ingenic_2d *ingenic_2d,
struct ingenic_2d_rect *src,
struct ingenic_2d_rect *dst);
#endif

View File

@ -1,178 +0,0 @@
#ifndef __LIBHARDWARE2_ADC_H__
#define __LIBHARDWARE2_ADC_H__
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief 使 ADC
* @param channle_id
* @return -1
*/
long adc_enable(unsigned int channle_id);
/**
* @brief ADC
* @param handle
*/
void adc_disable(long handle);
/**
* @brief ADC
* @param handle adc_enable()
* @param vref ADC参考电压值
* @return 0
*/
int adc_set_vref(long handle, unsigned int vref);
/**
* @brief ADC
* @param handle adc_enable()
* @return
*/
int adc_get_vref(long handle);
/**
* @brief ADC
* @param handle adc_enable()
* @return
*/
int adc_get_value(long handle);
/**
* @brief ADC
* @param handle adc_enable()
* @return
*/
int adc_get_voltage(long handle);
enum adc_trigger_type {
adc_trigger_tcu0_half,
adc_trigger_tcu0_full,
adc_trigger_tcu1_half,
adc_trigger_tcu1_full,
adc_trigger_tcu2_half,
adc_trigger_tcu2_full,
adc_trigger_tcu3_half,
adc_trigger_tcu3_full,
adc_trigger_tcu4_half,
adc_trigger_tcu4_full,
adc_trigger_tcu5_half,
adc_trigger_tcu5_full,
adc_trigger_tcu6_half,
adc_trigger_tcu6_full,
adc_trigger_tcu7_half,
adc_trigger_tcu7_full,
adc_trigger_gpio_rising_edge,
adc_trigger_gpio_falling_edge,
adc_trigger_gpio_both_edge,
adc_trigger_software,
};
struct adc_seq0_config {
unsigned char channel_cnt; // adc 采样序列使用的adc 通道总数
unsigned char channels[4]; // 采样序列依次的通道号
void (*irq_cb)(void); // 中断回调函数,当一个转换序列完成之后回调,回调中需要读取adc数据
};
struct adc_seq1_config {
int continus_clk_div; // 连续采样模式的计数时钟 = adc_clk / continus_clk_div; 最大值 2的24次方
int delay_clk_div; // 采样延时计数时钟 = adc_clk / delay_clk_div; 最大值 2的24次方
enum adc_trigger_type trigger; // adc 采样触发类型
unsigned char enable_channel_num; // 使能采样通道号,保存在数据的12-15 4bit位
unsigned char channel_cnt; // adc 采样序列使用的adc 通道总数
unsigned char channels[16]; // 采样序列依次的通道号
unsigned short channel_delays[16]; // 采样序列每个通道的延时, 单位是 adc delay clk
unsigned char group_cnt; // 连续采样模式下分组的个数,0表示不使能连续采样
unsigned char groups[8]; // 分组模式依次对应每组通道的个数
unsigned short group_delays[8]; // 每个分组转换完之后的延时, 单位是 adc cont clk
long is_enable_irq; /* 对应驱动的 void (*irq_cb)(void);
awd模式外使 */
};
struct adc_seq2_config {
int delay_clk_div; // 采样延时计数时钟 = adc_clk / delay_clk_div; 最大值 2的24次方
enum adc_trigger_type trigger; // adc 采样触发类型
unsigned char enable_channel_num; // 使能采样通道号,保存在数据的12-15 4bit位
unsigned char channel_cnt; // adc 采样序列使用的adc 通道总数
unsigned char channels[8]; // 采样序列依次的通道号
unsigned char channel_delays[8]; // 采样序列每个通道的延时, 单位是 adc delay clk
void (*irq_cb)(void); // 中断回调函数,当一个转换序列完成之后回调,回调中需要读取adc数据
};
/**
* @brief ADC "/dev/jz_adc_seq"
* @return -1
*/
int adc_open(void);
/**
* @brief ADC
* @param handle
* @return
*/
int adc_close(long handle);
/**
* @brief 使 ADC seq1
* @param handle adc_open()
* @param adc_seq1
* @return
*/
int adc_seq1_enable(long handle, struct adc_seq1_config adc_seq1);
/**
* @brief ADC seq1
* @param handle adc_open()
* @param adc_seq1
* @return
*/
int adc_seq1_disable(long handle, struct adc_seq1_config adc_seq1);
/**
* @brief ADC seq1
* @param handle adc_open()
* @param timeout
* @param data data[16]
* @return
*/
int adc_seq1_read_timeout(long handle, int timeout, unsigned short *data);
/**
* @brief 使 ADC awd 使seq1的连续采集模式触发检测
* @param handle adc_open()
* @param channel 使
* @param low_threshold adc value < low_threshold awd低阈值中断< 0 使
* @param high_threshold adc value > high_threshold awd高阈值中断< 0 使
* @return
*/
int adc_awd_enable(long handle, unsigned int channel, int low_threshold, int high_threshold);
/**
* @brief ADC awd
* @param handle adc_open()
* @return
*/
int adc_awd_disable(long handle);
/**
* @brief ADC awd
* @param handle adc_open()
* @param timeout
* @param awd_low_flags
* @param awd_high_flags
* @return
*/
int adc_awd_read_timeout(long handle, int timeout, unsigned short *awd_low_flags, unsigned short *awd_high_flags);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,98 +0,0 @@
#ifndef __LIBHARDWARE2_AES_H__
#define __LIBHARDWARE2_AES_H__
#ifdef __cplusplus
extern "C" {
#endif
enum aes_keyl {
AES128,
AES192,
AES256,
};
enum aes_mode {
ECB_MODE,
CBC_MODE,
};
enum aes_endian {
ENDIAN_LITTLE,
ENDIAN_BIG, /* openssl uses */
};
enum aes_dece {
ENCRYPTION,
DECRYPTION,
};
struct aes_config {
enum aes_keyl keyl; /* 密钥长度: 0:128 1:196 2:256 */
enum aes_mode mode; /* 编解码是否前后相关: 0:ecb 1:cbc */
enum aes_endian endian; /* 编解码数据输入大小端模式: 0:little 1:big */
unsigned char ukey[33]; /* 用户传入的密钥 */
unsigned char iv[17]; /* 初始化向量(cbc模式使用) */
};
/**
* @brief aes设备句柄, aes配置结构体内的ukey以及keyl转化得出实际密钥, aes_handle结构体,
* aes配置结构体config aes设备句柄fd key存放到aes_handle结构体内
* @param config aes配置结构体, ,,,,(cbc模式使用)
* @return aes_handle结构体, NULL
*/
struct aes_handle *aes_open(struct aes_config *config);
/**
* @brief handle内的设备句柄fd关闭aes设备, handle结构体
* @param handle aes设备句柄结构体
* @return
*/
void aes_close(struct aes_handle *handle);
/**
* @brief src len字节 dst内
* @param handle aes设备句柄结构体, aes设备句柄fd,
* aes配置结构体config(,,,,(cbc模式使用))
* @param src
* @param dst
* @param len
* @return 0,
*/
int aes_encrypt(struct aes_handle *handle, unsigned char *src, unsigned char *dst, unsigned int len);
/**
* @brief src len字节 dst内
* @param handle aes设备句柄结构体, aes设备句柄fd,
* aes配置结构体config(,,,,(cbc模式使用))
* @param src
* @param dst
* @param len
* @return 0,
*/
int aes_decrypt(struct aes_handle *handle, unsigned char *src, unsigned char *dst, unsigned int len);
/**
* @brief in_file文件内容并将结果保存在out_file内
* @param handle aes设备句柄结构体, aes设备句柄fd,
* aes配置结构体config(,,,,(cbc模式使用))
* @param in_file , in_file文件大小以16字节对齐
* @param out_file
* @return 0,
*/
int aes_encrypt_file(struct aes_handle *handle, unsigned char *in_file, unsigned char *out_file);
/**
* @brief in_file文件内容并将结果保存在out_file内
* @param handle aes设备句柄结构体, aes设备句柄fd,
* aes配置结构体config(,,,,(cbc模式使用))
* @param in_file , in_file文件大小以16字节对齐
* @param out_file
* @return 0,
*/
int aes_decrypt_file(struct aes_handle *handle, unsigned char *in_file, unsigned char *out_file);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,189 +0,0 @@
#ifndef _LIBHARDWARE2_ALSA_H_
#define _LIBHARDWARE2_ALSA_H_
#include <alsa/asoundlib.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief alsa
*/
struct alsa_params {
/* 调用alsa_pcm_set_params 时设置
* rate: pcm , 44100, 48000, 16000,,,
* channels: pcm , 1, 2, 4,,,
* format: <alsa/pcm.h>, SND_PCM_FORMAT_S16_LE
*/
unsigned int rate;
unsigned int channels;
snd_pcm_format_t format;
/* 调用alsa_pcm_set_params 时设置, 调用后会返回真实的结果
* 0
* buffer_time: pcm /, us, 300*1000300
* period_time: pcm , us,50*100050
*/
unsigned int buffer_time;
unsigned int period_time;
/* 调用alsa_pcm_set_params 之后获得结果
* frame_bytes ,
* period_frames
* buffer_frames
*/
unsigned int frame_bytes;
unsigned int period_frames;
unsigned int buffer_frames;
};
/**
* @brief /
*/
struct alsa_pcm;
/**
* @brief
* @param device ,"hw:1,0" "plughw:1,0" "defualt"
* @return ,NULL表示不成功
*/
struct alsa_pcm *alsa_pcm_open_capture_device(const char *device);
/**
* @brief
* @param device ,"hw:1,0" "plughw:1,0" "defualt"
* @return ,NULL表示不成功
*/
struct alsa_pcm *alsa_pcm_open_playback_device(const char *device);
/**
* @brief alsa设备
* @param alsa , alsa_pcm_open_capture/playback_device
*/
void alsa_pcm_close(struct alsa_pcm *alsa);
/**
* @brief /
* @param alsa
* @param param @see struct alsa_params
* @return 0: :
*/
int alsa_pcm_set_params(struct alsa_pcm *alsa, struct alsa_params *param);
/**
* @brief /
* @param alsa
* @return 0: :
*/
int alsa_pcm_free_params(struct alsa_pcm *alsa);
/**
* @brief
* @param alsa
* @param buffer
* @param frames
* @return 0: :
*/
int alsa_pcm_read(struct alsa_pcm *alsa, void *buffer, int frames);
/**
* @brief
* @param alsa
* @param buffer
* @param frames
* @return 0: :
*/
int alsa_pcm_write(struct alsa_pcm *alsa, void *buffer, int frames);
/**
* @brief
* @param alsa
* @return 0: :
*/
int alsa_pcm_drop(struct alsa_pcm *alsa);
/**
* @brief /
* @param alsa
* @return
*/
int alsa_pcm_avil(struct alsa_pcm *alsa);
/**
* @brief ,
* @param alsa
* @return 0: :
*/
int alsa_pcm_drain(struct alsa_pcm *alsa);
/**
* @brief
* @param alsa
* @return 0: :
*/
int alsa_pcm_start(struct alsa_pcm *alsa);
/**
* @brief
*/
struct alsa_ctl;
/**
* @brief
* @param card_name ,"hw:1" "plughw:1" "defualt"
* @param ctl_name ,
* ,
* @return ,NULL表示不成功
*/
struct alsa_ctl *alsa_ctl_open(const char *card_name, const char *ctl_name);
/**
* @brief
* @param ctl , alsa_ctl_open
*/
void alsa_ctl_close(struct alsa_ctl *ctl);
/**
* @brief
* @return
*/
const char *alsa_ctl_get_name(struct alsa_ctl *ctl);
/**
* @brief
* @param ctl
* @param value
* @return 0: :
*/
int alsa_ctl_set_value(struct alsa_ctl *ctl, long value);
/**
* @brief
* @param ctl
* @param value
* @return 0: :
*/
int alsa_ctl_get_value(struct alsa_ctl *ctl, long *value);
/**
* @brief
* @param ctl
* @param min
* @param max
* @return 0: :
*/
int alsa_ctl_get_value_range(struct alsa_ctl *ctl, long *min, long *max);
/**
* @brief
* @param card_name ,"hw:1" "plughw:1" "defualt"
* @return 0 :
*/
int alsa_ctl_list_all(const char *card_name);
#ifdef __cplusplus
}
#endif
#endif /* _LIBHARDWARE2_ALSA_H_ */

View File

@ -1,102 +0,0 @@
#ifndef _VIDEO_AVPU_H264_ENCODE_H_
#define _VIDEO_AVPU_H264_ENCODE_H_
#include <stdbool.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
struct avpu_h264_encoder_config {
unsigned int width;
unsigned int height;
unsigned int frame_rate;
unsigned int input_fmt;
unsigned int gop_size;
unsigned int bitrate;
};
struct avpu_h264_encoder;
/*
* AVPU编码器申请的帧大小 NV12格式 ( * [16] * 3 / 2)
* encoder : AVPU编码器句柄
* : AVPU申请帧大小
*/
uint32_t avpu_h264_encoder_get_frame_size(struct avpu_h264_encoder *encoder);
/*
* AVPU编码器存放UV数据偏移 ( * [16])
* encoder : AVPU编码器句柄
* : UV数据偏移
*/
uint32_t avpu_h264_encoder_get_uv_offset(struct avpu_h264_encoder *encoder);
/*
* AVPU h264模式
*/
struct avpu_h264_encoder *avpu_h264_encoder_open(struct avpu_h264_encoder_config *config);
/*
* NV12数据编码为h264格式
* encoder : AVPU编码器句柄
* map_vaddr : . video_avpu_encoder_alloc
* out_length: h264编码处理后的大小
* out_frame : h264编码后的数据, malloc申请获得该地址
* : =0
* <0
*/
int avpu_h264_encoder_work(struct avpu_h264_encoder *encoder, void *map_vaddr, uint32_t *out_length, void *out_frame);
/*
* AVPU
*/
int avpu_h264_encoder_close(struct avpu_h264_encoder *encoder);
/*
* AVPU编码器初始化
*/
int avpu_encoder_init(void);
/*
* AVPU编码器去初始化
*/
void avpu_encoder_deinit(void);
/*
* AVPU编码器中申请内存
* : mmap后应用层操作虚拟地址
* size: , 256
*/
void *avpu_encoder_alloc(int size);
/*
* AVPU编码器中释放内存
* : vaddr是mmap后应用层的虚拟地址
*/
void avpu_encoder_free(void *vaddr);
/*
* VPU编码器中申请的虚拟地址对应的物理地址
* : vaddr是mmap后应用层的地址
*/
void *avpu_encoder_vitr_to_phys(void *vaddr);
/*
* VPU编码器中申请的物理地址对应
* : vaddr是mmap后应用层的地址
*/
void *avpu_encoder_phys_to_virt(void *paddr);
#ifdef __cplusplus
}
#endif
#endif /* _VIDEO_AVPU_H264_ENCODE_H_ */

View File

@ -1,102 +0,0 @@
#ifndef _VIDEO_AVPU_JPEG_ENCODE_H_
#define _VIDEO_AVPU_JPEG_ENCODE_H_
#include <stdbool.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
struct avpu_jpeg_encoder_config {
unsigned int width;
unsigned int height;
unsigned int frame_rate;
unsigned int input_fmt;
unsigned int gop_size;
unsigned int bitrate;
};
struct avpu_jpeg_encoder;
/*
* AVPU编码器申请的帧大小 NV12格式 ( * [16] * 3 / 2)
* encoder : AVPU编码器句柄
* : AVPU申请帧大小
*/
uint32_t avpu_jpeg_encoder_get_frame_size(struct avpu_jpeg_encoder *encoder);
/*
* AVPU编码器存放UV数据偏移 ( * [16])
* encoder : AVPU编码器句柄
* : UV数据偏移
*/
uint32_t avpu_jpeg_encoder_get_uv_offset(struct avpu_jpeg_encoder *encoder);
/*
* AVPU jpeg模式
*/
struct avpu_jpeg_encoder *avpu_jpeg_encoder_open(struct avpu_jpeg_encoder_config *config);
/*
* NV12数据编码为jpeg格式
* encoder : AVPU编码器句柄
* map_vaddr : . video_avpu_encoder_alloc
* out_length: jpeg编码处理后的大小
* out_frame : jpeg编码后的数据, malloc申请获得该地址
* : =0
* <0
*/
int avpu_jpeg_encoder_work(struct avpu_jpeg_encoder *encoder, void *map_vaddr, uint32_t *out_length, void *out_frame);
/*
* AVPU
*/
int avpu_jpeg_encoder_close(struct avpu_jpeg_encoder *encoder);
/*
* AVPU编码器初始化
*/
int avpu_encoder_init(void);
/*
* AVPU编码器去初始化
*/
void avpu_encoder_deinit(void);
/*
* AVPU编码器中申请内存
* : mmap后应用层操作虚拟地址
* size: , 256
*/
void *avpu_encoder_alloc(int size);
/*
* AVPU编码器中释放内存
* : vaddr是mmap后应用层的虚拟地址
*/
void avpu_encoder_free(void *vaddr);
/*
* VPU编码器中申请的虚拟地址对应的物理地址
* : vaddr是mmap后应用层的地址
*/
void *avpu_encoder_vitr_to_phys(void *vaddr);
/*
* VPU编码器中申请的物理地址对应
* : vaddr是mmap后应用层的地址
*/
void *avpu_encoder_phys_to_virt(void *paddr);
#ifdef __cplusplus
}
#endif
#endif /* _VIDEO_AVPU_JPEG_ENCODE_H_ */

View File

@ -1,204 +0,0 @@
#ifndef _LIBHARDWARE2_CAMERA_H_
#define _LIBHARDWARE2_CAMERA_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <libhardware2/camera_common.h>
/* 计算每个像素点所占字节数 */
unsigned int cam_bytes_per_pixel(camera_pixel_fmt cam_fmt);
/**
* @brief camera设备句柄
* @param info camera的信息,NULL
* @param device_path
* @return ,-1
*/
int camera_open(struct camera_info *info, const char* device_path);
/**
* @brief camera设备句柄
* @param fd camera设备句柄,camera_open()
* @param info camera的信息,camera_open()
* @return 0,-1
*/
int camera_close(int fd, struct camera_info *info);
/**
* @brief 使camera设备,
* @param fd camera设备句柄,camera_open()
* @return 0,
*/
int camera_power_on(int fd);
/**
* @brief camera设备,
* @param fd camera设备句柄,camera_open()
* @return 0,
*/
int camera_power_off(int fd);
/**
* @brief camera图像录制
* @param fd camera设备句柄,camera_open()
* @return 0,
*/
int camera_stream_on(int fd);
/**
* @brief camera图像录制
* @param fd camera设备句柄,camera_open()
* @return 0,
*/
int camera_stream_off(int fd);
/**
* @brief
* @param fd camera设备句柄,camera_open()
* @return ,NULL
*/
void *camera_wait_frame(int fd);
/**
* @brief
* @param fd camera设备句柄,camera_open()
* @return ,NULL
*/
void *camera_get_frame(int fd);
/**
* @brief
* @param fd camera设备句柄,camera_open()
* @param mem ,camera_wait_frame()
* @return 0,
*/
int camera_put_frame(int fd, void *mem);
/**
* @brief ()
* @param fd camera设备句柄,camera_open()
* @param frame
* @return 0,
*/
int camera_dqbuf(int fd, struct frame_info *frame);
/**
* @brief (3s)
* @param fd camera设备句柄,camera_open()
* @param frame
* @return 0,
*/
int camera_dqbuf_wait(int fd, struct frame_info *frame);
/**
* @brief
* @param fd camera设备句柄,camera_open()
* @param frame
* @return 0,
*/
int camera_qbuf(int fd, struct frame_info *frame);
/**
* @brief
* @param fd camera设备句柄,camera_open()
* @return ,
*/
int camera_get_avaliable_frame_count(int fd);
/**
* @brief
* @param fd camera设备句柄,camera_open()
* @param frames
* @return ,
*/
int camera_drop_frames(int fd, unsigned int frames);
/**
* @brief sensor寄存器
* @param fd camera设备句柄,camera_open()
* @param reg sensor寄存器信息
* @return 0,
*/
int camera_get_sensor_reg(int fd, struct sensor_dbg_register *reg);
/**
* @brief sensor寄存器
* @param fd camera设备句柄,camera_open()
* @param reg sensor寄存器信息
* @return 0,
*/
int camera_set_sensor_reg(int fd, struct sensor_dbg_register *reg);
/**
* @brief sensor帧率
* @param fd camera设备句柄,camera_open()
* @param fps_num
* @param fps_den
* @return 0,
*/
int camera_get_fps(int fd, unsigned int *fps_num, unsigned int *fps_den);
/**
* @brief sensor帧率
* @param fd camera设备句柄,camera_open()
* @param fps_num
* @param fps_den
* @return 0,
*/
int camera_set_fps(int fd, unsigned int fps_num, unsigned int fps_den);
/**
* camera功能开关
*/
typedef enum {
CAMERA_OPS_MODE_DISABLE = 0, /* 不使能该模块功能 */
CAMERA_OPS_MODE_ENABLE, /* 使能该模块功能 */
} camera_ops_mode;
/**
* @brief sensor水平镜像使能模式
* @param fd camera设备句柄,camera_open()
* @param mode 使
* @return 0,
*/
int camera_get_hflip(int fd, camera_ops_mode *mode);
/**
* @brief sensor水平镜像使能模式
* @param fd camera设备句柄,camera_open()
* @param mode 使
* @return 0,
*/
int camera_set_hflip(int fd, camera_ops_mode mode);
/**
* @brief sensor垂直翻转使能模式
* @param fd camera设备句柄,camera_open()
* @param mode 使
* @return 0,
*/
int camera_get_vflip(int fd, camera_ops_mode *mode);
/**
* @brief sensor垂直翻转使能模式
* @param fd camera设备句柄,camera_open()
* @param mode 使
* @return 0,
*/
int camera_set_vflip(int fd, camera_ops_mode mode);
/**
* @brief camera格式
* @param info camera的信息,NULL取决于sensor驱动
* @return ,-1
*/
int camera_reset_fmt(int fd, struct camera_info *info);
#ifdef __cplusplus
}
#endif
#endif /* _LIBHARDWARE2_CAMERA_H_ */

View File

@ -1,77 +0,0 @@
#ifndef _LIBHARDWARE2_CAMERA_COMMON_H_
#define _LIBHARDWARE2_CAMERA_COMMON_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <libhardware2/camera_pixel_format.h>
struct sensor_dbg_register {
unsigned long long reg;
unsigned long long val;
unsigned int size; /* val size, unit:byte */
};
struct camera_info {
char name[64];
/* 每行像素数 */
unsigned int width;
/* 行数 */
unsigned int height;
/* camera 帧率 */
unsigned int fps;
/* camera 帧数据格式 */
camera_pixel_fmt data_fmt;
/* 一行的长度,单位字节
* nv12,nv21, y数据一行的长度
* uv数据偏移 line_length*height
*/
unsigned int line_length;
/* 一帧数据经过对齐之前的大小 */
unsigned int frame_size;
/* 帧缓冲总数 */
unsigned int frame_nums;
/* 帧缓冲的物理基地址 */
unsigned long phys_mem;
/* mmap 后的帧缓冲基地址 */
void *mapped_mem;
/*帧对齐大小 */
unsigned int frame_align_size;
};
/* 图像帧信息 */
struct frame_info {
unsigned int index; /* 帧缓存编号 */
unsigned int sequence; /* 帧序列号 */
unsigned int width; /* 帧宽 */
unsigned int height; /* 帧高 */
unsigned int pixfmt; /* 帧的图像格式 */
unsigned int size; /* 帧所占用空间大小 */
void *vaddr; /* 帧的虚拟地址 */
unsigned long paddr; /* 帧的物理地址 */
unsigned long long timestamp; /* 帧的时间戳,单位微秒,单调时间 */
unsigned int isp_timestamp; /* isp时间戳在vic通过isp clk计数换算得出单位微秒
10000isp clk相关 */
unsigned int shutter_count; /* 曝光计数 */
};
#ifdef __cplusplus
}
#endif
#endif /* _LIBHARDWARE2_CAMERA_COMMON_H_ */

View File

@ -1,279 +0,0 @@
#ifndef _CAMERA_PIXEL_FORMAT_H_
#define _CAMERA_PIXEL_FORMAT_H_
/*
* module_driver下头文件camera_pixel_format.h保持一致
*/
/* Four-character-code (FOURCC) */
#define camera_fourcc(a, b, c, d)\
((unsigned int)(a) | ((unsigned int)(b) << 8) | ((unsigned int)(c) << 16) | ((unsigned int)(d) << 24))
#define camera_fourcc_be(a, b, c, d) (camera_fourcc(a, b, c, d) | (1 << 31))
/*
* Camera Pixel Format (re-define from videodev2.h)
*/
typedef enum {
/* RGB formats */
CAMERA_PIX_FMT_RGB332 = camera_fourcc('R', 'G', 'B', '1'), /* 8 RGB-3-3-2 */
CAMERA_PIX_FMT_RGB444 = camera_fourcc('R', '4', '4', '4'), /* 16 xxxxrrrr ggggbbbb */
CAMERA_PIX_FMT_ARGB444 = camera_fourcc('A', 'R', '1', '2'), /* 16 aaaarrrr ggggbbbb */
CAMERA_PIX_FMT_XRGB444 = camera_fourcc('X', 'R', '1', '2'), /* 16 xxxxrrrr ggggbbbb */
CAMERA_PIX_FMT_RGB555 = camera_fourcc('R', 'G', 'B', 'O'), /* 16 RGB-5-5-5 */
CAMERA_PIX_FMT_ARGB555 = camera_fourcc('A', 'R', '1', '5'), /* 16 ARGB-1-5-5-5 */
CAMERA_PIX_FMT_XRGB555 = camera_fourcc('X', 'R', '1', '5'), /* 16 XRGB-1-5-5-5 */
CAMERA_PIX_FMT_RGB565 = camera_fourcc('R', 'G', 'B', 'P'), /* 16 RGB-5-6-5 */
CAMERA_PIX_FMT_RGB555X = camera_fourcc('R', 'G', 'B', 'Q'), /* 16 RGB-5-5-5 BE */
CAMERA_PIX_FMT_ARGB555X = camera_fourcc_be('A', 'R', '1', '5'), /* 16 ARGB-5-5-5 BE */
CAMERA_PIX_FMT_XRGB555X = camera_fourcc_be('X', 'R', '1', '5'), /* 16 XRGB-5-5-5 BE */
CAMERA_PIX_FMT_RGB565X = camera_fourcc('R', 'G', 'B', 'R'), /* 16 RGB-5-6-5 BE */
CAMERA_PIX_FMT_BGR666 = camera_fourcc('B', 'G', 'R', 'H'), /* 18 BGR-6-6-6 */
CAMERA_PIX_FMT_BGR24 = camera_fourcc('B', 'G', 'R', '3'), /* 24 BGR-8-8-8 */
CAMERA_PIX_FMT_RGB24 = camera_fourcc('R', 'G', 'B', '3'), /* 24 RGB-8-8-8 */
CAMERA_PIX_FMT_RBG24 = camera_fourcc('R', 'B', 'G', '3'), /* 24 RGB-8-8-8 */
CAMERA_PIX_FMT_GBR24 = camera_fourcc('G', 'B', 'R', '3'), /* 24 RGB-8-8-8 */
CAMERA_PIX_FMT_BGR32 = camera_fourcc('B', 'G', 'R', '4'), /* 32 BGR-8-8-8-8 */
CAMERA_PIX_FMT_ABGR32 = camera_fourcc('A', 'R', '2', '4'), /* 32 BGRA-8-8-8-8 */
CAMERA_PIX_FMT_XBGR32 = camera_fourcc('X', 'R', '2', '4'), /* 32 BGRX-8-8-8-8 */
CAMERA_PIX_FMT_RGB32 = camera_fourcc('R', 'G', 'B', '4'), /* 32 RGB-8-8-8-8 */
CAMERA_PIX_FMT_ARGB32 = camera_fourcc('B', 'A', '2', '4'), /* 32 ARGB-8-8-8-8 */
CAMERA_PIX_FMT_XRGB32 = camera_fourcc('B', 'X', '2', '4'), /* 32 XRGB-8-8-8-8 */
/* Grey formats */
CAMERA_PIX_FMT_GREY = camera_fourcc('G', 'R', 'E', 'Y'), /* 8 Greyscale */
CAMERA_PIX_FMT_Y4 = camera_fourcc('Y', '0', '4', ' '), /* 4 Greyscale */
CAMERA_PIX_FMT_Y6 = camera_fourcc('Y', '0', '6', ' '), /* 6 Greyscale */
CAMERA_PIX_FMT_Y10 = camera_fourcc('Y', '1', '0', ' '), /* 10 Greyscale */
CAMERA_PIX_FMT_Y12 = camera_fourcc('Y', '1', '2', ' '), /* 12 Greyscale */
CAMERA_PIX_FMT_Y16 = camera_fourcc('Y', '1', '6', ' '), /* 16 Greyscale */
CAMERA_PIX_FMT_Y16_BE = camera_fourcc_be('Y', '1', '6', ' '), /* 16 Greyscale BE */
/* Luminance+Chrominance formats */
CAMERA_PIX_FMT_YVU410 = camera_fourcc('Y', 'V', 'U', '9'), /* 9 YVU 4:1:0 */
CAMERA_PIX_FMT_YVU420 = camera_fourcc('Y', 'V', '1', '2'), /* 12 YVU 4:2:0 */
CAMERA_PIX_FMT_JZ420B = camera_fourcc('J', 'Z', '1', '2'), /* 12 YUV 4:2:0 B */
CAMERA_PIX_FMT_YUYV = camera_fourcc('Y', 'U', 'Y', 'V'), /* 16 YUV 4:2:2 */
CAMERA_PIX_FMT_YYUV = camera_fourcc('Y', 'Y', 'U', 'V'), /* 16 YUV 4:2:2 */
CAMERA_PIX_FMT_YVYU = camera_fourcc('Y', 'V', 'Y', 'U'), /* 16 YVU 4:2:2 */
CAMERA_PIX_FMT_UYVY = camera_fourcc('U', 'Y', 'V', 'Y'), /* 16 YUV 4:2:2 */
CAMERA_PIX_FMT_VYUY = camera_fourcc('V', 'Y', 'U', 'Y'), /* 16 YUV 4:2:2 */
CAMERA_PIX_FMT_YUV422P = camera_fourcc('4', '2', '2', 'P'), /* 16 YVU422 planar */
CAMERA_PIX_FMT_YUV411P = camera_fourcc('4', '1', '1', 'P'), /* 16 YVU411 planar */
CAMERA_PIX_FMT_Y41P = camera_fourcc('Y', '4', '1', 'P'), /* 12 YUV 4:1:1 */
CAMERA_PIX_FMT_YUV444 = camera_fourcc('Y', '4', '4', '4'), /* 16 xxxxyyyy uuuuvvvv */
CAMERA_PIX_FMT_YUV555 = camera_fourcc('Y', 'U', 'V', 'O'), /* 16 YUV-5-5-5 */
CAMERA_PIX_FMT_YUV565 = camera_fourcc('Y', 'U', 'V', 'P'), /* 16 YUV-5-6-5 */
CAMERA_PIX_FMT_YUV32 = camera_fourcc('Y', 'U', 'V', '4'), /* 32 YUV-8-8-8-8 */
CAMERA_PIX_FMT_YUV410 = camera_fourcc('Y', 'U', 'V', '9'), /* 9 YUV 4:1:0 */
CAMERA_PIX_FMT_YUV420 = camera_fourcc('Y', 'U', '1', '2'), /* 12 YUV 4:2:0 */
CAMERA_PIX_FMT_HI240 = camera_fourcc('H', 'I', '2', '4'), /* 8 8-bit color */
CAMERA_PIX_FMT_HM12 = camera_fourcc('H', 'M', '1', '2'), /* 8 YUV 4:2:0 16x16 macroblocks */
CAMERA_PIX_FMT_M420 = camera_fourcc('M', '4', '2', '0'), /* 12 YUV 4:2:0 2 lines y, 1 line uv interleaved */
/* two planes -- one Y, one Cr + Cb interleaved */
CAMERA_PIX_FMT_NV12 = camera_fourcc('N', 'V', '1', '2'), /* 12 Y/CbCr 4:2:0 */
CAMERA_PIX_FMT_NV21 = camera_fourcc('N', 'V', '2', '1'), /* 12 Y/CrCb 4:2:0 */
CAMERA_PIX_FMT_NV16 = camera_fourcc('N', 'V', '1', '6'), /* 16 Y/CbCr 4:2:2 */
CAMERA_PIX_FMT_NV61 = camera_fourcc('N', 'V', '6', '1'), /* 16 Y/CrCb 4:2:2 */
CAMERA_PIX_FMT_NV24 = camera_fourcc('N', 'V', '2', '4'), /* 24 Y/CbCr 4:4:4 */
CAMERA_PIX_FMT_NV42 = camera_fourcc('N', 'V', '4', '2'), /* 24 Y/CrCb 4:4:4 */
/* Bayer formats - see http://www.siliconimaging.com/RGB%20Bayer.htm */
CAMERA_PIX_FMT_SBGGR8 = camera_fourcc('B', 'A', '8', '1'), /* 8 BGBG.. GRGR.. */
CAMERA_PIX_FMT_SGBRG8 = camera_fourcc('G', 'B', 'R', 'G'), /* 8 GBGB.. RGRG.. */
CAMERA_PIX_FMT_SGRBG8 = camera_fourcc('G', 'R', 'B', 'G'), /* 8 GRGR.. BGBG.. */
CAMERA_PIX_FMT_SRGGB8 = camera_fourcc('R', 'G', 'G', 'B'), /* 8 RGRG.. GBGB.. */
CAMERA_PIX_FMT_SBGGR10 = camera_fourcc('B', 'G', '1', '0'), /* 10 BGBG.. GRGR.. */
CAMERA_PIX_FMT_SGBRG10 = camera_fourcc('G', 'B', '1', '0'), /* 10 GBGB.. RGRG.. */
CAMERA_PIX_FMT_SGRBG10 = camera_fourcc('B', 'A', '1', '0'), /* 10 GRGR.. BGBG.. */
CAMERA_PIX_FMT_SRGGB10 = camera_fourcc('R', 'G', '1', '0'), /* 10 RGRG.. GBGB.. */
CAMERA_PIX_FMT_SBGGR12 = camera_fourcc('B', 'G', '1', '2'), /* 12 BGBG.. GRGR.. */
CAMERA_PIX_FMT_SGBRG12 = camera_fourcc('G', 'B', '1', '2'), /* 12 GBGB.. RGRG.. */
CAMERA_PIX_FMT_SGRBG12 = camera_fourcc('B', 'A', '1', '2'), /* 12 GRGR.. BGBG.. */
CAMERA_PIX_FMT_SRGGB12 = camera_fourcc('R', 'G', '1', '2'), /* 12 RGRG.. GBGB.. */
/* Add New Item */
CAMERA_PIX_FMT_SBGGR16 = camera_fourcc('B', 'Y', 'R', '2'), /* 16 BGBG.. GRGR.. */
CAMERA_PIX_FMT_SGBRG16 = camera_fourcc('Y', 'B', 'R', '2'), /* 16 GBGB.. RGRG.. */
CAMERA_PIX_FMT_SGRBG16 = camera_fourcc('Y', 'R', 'B', '2'), /* 16 GRGR.. BGBG.. */
CAMERA_PIX_FMT_SRGGB16 = camera_fourcc('R', 'Y', 'B', '2'), /* 16 RGRG.. GBGB.. */
} camera_pixel_fmt;
/*
* Sensor Pixel Format (re-define from media-bus-format.h)
*/
typedef enum {
SENSOR_PIXEL_FMT_FIXED = 0x0001,
/* RGB - next is 0x1018 */
SENSOR_PIXEL_FMT_RGB444_1X12 = 0x1016,
SENSOR_PIXEL_FMT_RGB444_2X8_PADHI_BE = 0x1001,
SENSOR_PIXEL_FMT_RGB444_2X8_PADHI_LE = 0x1002,
SENSOR_PIXEL_FMT_RGB555_2X8_PADHI_BE = 0x1003,
SENSOR_PIXEL_FMT_RGB555_2X8_PADHI_LE = 0x1004,
SENSOR_PIXEL_FMT_RGB565_1X16 = 0x1017,
SENSOR_PIXEL_FMT_BGR565_2X8_BE = 0x1005,
SENSOR_PIXEL_FMT_BGR565_2X8_LE = 0x1006,
SENSOR_PIXEL_FMT_RGB565_2X8_BE = 0x1007,
SENSOR_PIXEL_FMT_RGB565_2X8_LE = 0x1008,
SENSOR_PIXEL_FMT_RGB666_1X18 = 0x1009,
SENSOR_PIXEL_FMT_RBG888_1X24 = 0x100e,
SENSOR_PIXEL_FMT_RGB666_1X24_CPADHI = 0x1015,
SENSOR_PIXEL_FMT_RGB666_1X7X3_SPWG = 0x1010,
SENSOR_PIXEL_FMT_BGR888_1X24 = 0x1013,
SENSOR_PIXEL_FMT_GBR888_1X24 = 0x1014,
SENSOR_PIXEL_FMT_RGB888_1X24 = 0x100a,
SENSOR_PIXEL_FMT_RGB888_2X12_BE = 0x100b,
SENSOR_PIXEL_FMT_RGB888_2X12_LE = 0x100c,
SENSOR_PIXEL_FMT_RGB888_1X7X4_SPWG = 0x1011,
SENSOR_PIXEL_FMT_RGB888_1X7X4_JEIDA = 0x1012,
SENSOR_PIXEL_FMT_ARGB8888_1X32 = 0x100d,
SENSOR_PIXEL_FMT_RGB888_1X32_PADHI = 0x100f,
/* YUV (including grey) - next is 0x2026 */
SENSOR_PIXEL_FMT_Y8_1X8 = 0x2001,
SENSOR_PIXEL_FMT_UV8_1X8 = 0x2015,
SENSOR_PIXEL_FMT_UYVY8_1_5X8 = 0x2002,
SENSOR_PIXEL_FMT_VYUY8_1_5X8 = 0x2003,
SENSOR_PIXEL_FMT_YUYV8_1_5X8 = 0x2004,
SENSOR_PIXEL_FMT_YVYU8_1_5X8 = 0x2005,
SENSOR_PIXEL_FMT_UYVY8_2X8 = 0x2006,
SENSOR_PIXEL_FMT_VYUY8_2X8 = 0x2007,
SENSOR_PIXEL_FMT_YUYV8_2X8 = 0x2008,
SENSOR_PIXEL_FMT_YVYU8_2X8 = 0x2009,
SENSOR_PIXEL_FMT_Y10_1X10 = 0x200a,
SENSOR_PIXEL_FMT_UYVY10_2X10 = 0x2018,
SENSOR_PIXEL_FMT_VYUY10_2X10 = 0x2019,
SENSOR_PIXEL_FMT_YUYV10_2X10 = 0x200b,
SENSOR_PIXEL_FMT_YVYU10_2X10 = 0x200c,
SENSOR_PIXEL_FMT_Y12_1X12 = 0x2013,
SENSOR_PIXEL_FMT_UYVY12_2X12 = 0x201c,
SENSOR_PIXEL_FMT_VYUY12_2X12 = 0x201d,
SENSOR_PIXEL_FMT_YUYV12_2X12 = 0x201e,
SENSOR_PIXEL_FMT_YVYU12_2X12 = 0x201f,
SENSOR_PIXEL_FMT_UYVY8_1X16 = 0x200f,
SENSOR_PIXEL_FMT_VYUY8_1X16 = 0x2010,
SENSOR_PIXEL_FMT_YUYV8_1X16 = 0x2011,
SENSOR_PIXEL_FMT_YVYU8_1X16 = 0x2012,
SENSOR_PIXEL_FMT_YDYUYDYV8_1X16 = 0x2014,
SENSOR_PIXEL_FMT_UYVY10_1X20 = 0x201a,
SENSOR_PIXEL_FMT_VYUY10_1X20 = 0x201b,
SENSOR_PIXEL_FMT_YUYV10_1X20 = 0x200d,
SENSOR_PIXEL_FMT_YVYU10_1X20 = 0x200e,
SENSOR_PIXEL_FMT_VUY8_1X24 = 0x2024,
SENSOR_PIXEL_FMT_YUV8_1X24 = 0x2025,
SENSOR_PIXEL_FMT_UYVY12_1X24 = 0x2020,
SENSOR_PIXEL_FMT_VYUY12_1X24 = 0x2021,
SENSOR_PIXEL_FMT_YUYV12_1X24 = 0x2022,
SENSOR_PIXEL_FMT_YVYU12_1X24 = 0x2023,
SENSOR_PIXEL_FMT_YUV10_1X30 = 0x2016,
SENSOR_PIXEL_FMT_AYUV8_1X32 = 0x2017,
/* Bayer - next is 0x3019 */
SENSOR_PIXEL_FMT_SBGGR8_1X8 = 0x3001,
SENSOR_PIXEL_FMT_SGBRG8_1X8 = 0x3013,
SENSOR_PIXEL_FMT_SGRBG8_1X8 = 0x3002,
SENSOR_PIXEL_FMT_SRGGB8_1X8 = 0x3014,
SENSOR_PIXEL_FMT_SBGGR10_1X10 = 0x3007,
SENSOR_PIXEL_FMT_SGBRG10_1X10 = 0x300e,
SENSOR_PIXEL_FMT_SGRBG10_1X10 = 0x300a,
SENSOR_PIXEL_FMT_SRGGB10_1X10 = 0x300f,
SENSOR_PIXEL_FMT_SBGGR12_1X12 = 0x3008,
SENSOR_PIXEL_FMT_SGBRG12_1X12 = 0x3010,
SENSOR_PIXEL_FMT_SGRBG12_1X12 = 0x3011,
SENSOR_PIXEL_FMT_SRGGB12_1X12 = 0x3012,
/*
*
*/
SENSOR_PIXEL_FMT_SBGGR10_ALAW8_1X8 = 0x3015,
SENSOR_PIXEL_FMT_SGBRG10_ALAW8_1X8 = 0x3016,
SENSOR_PIXEL_FMT_SGRBG10_ALAW8_1X8 = 0x3017,
SENSOR_PIXEL_FMT_SRGGB10_ALAW8_1X8 = 0x3018,
SENSOR_PIXEL_FMT_SBGGR10_DPCM8_1X8 = 0x300b,
SENSOR_PIXEL_FMT_SGBRG10_DPCM8_1X8 = 0x300c,
SENSOR_PIXEL_FMT_SGRBG10_DPCM8_1X8 = 0x3009,
SENSOR_PIXEL_FMT_SRGGB10_DPCM8_1X8 = 0x300d,
SENSOR_PIXEL_FMT_SBGGR10_2X8_PADHI_BE = 0x3003,
SENSOR_PIXEL_FMT_SBGGR10_2X8_PADHI_LE = 0x3004,
SENSOR_PIXEL_FMT_SBGGR10_2X8_PADLO_BE = 0x3005,
SENSOR_PIXEL_FMT_SBGGR10_2X8_PADLO_LE = 0x3006,
/*
*
* Bayer - next is 0x3025
*/
SENSOR_PIXEL_FMT_SBGGR12_ALAW8_1X8 = 0x3019, /* 8-bit Bayer BGBG/GRGR (A-law) */
SENSOR_PIXEL_FMT_SGBRG12_ALAW8_1X8 = 0x301a,
SENSOR_PIXEL_FMT_SGRBG12_ALAW8_1X8 = 0x301b,
SENSOR_PIXEL_FMT_SRGGB12_ALAW8_1X8 = 0x301c,
SENSOR_PIXEL_FMT_SBGGR12_DPCM8_1X8 = 0x301d,
SENSOR_PIXEL_FMT_SGBRG12_DPCM8_1X8 = 0x301e,
SENSOR_PIXEL_FMT_SGRBG12_DPCM8_1X8 = 0x301f,
SENSOR_PIXEL_FMT_SRGGB12_DPCM8_1X8 = 0x3020,
SENSOR_PIXEL_FMT_SBGGR12_2X8_PADHI_BE = 0x3021,
SENSOR_PIXEL_FMT_SBGGR12_2X8_PADHI_LE = 0x3022,
SENSOR_PIXEL_FMT_SBGGR12_2X8_PADLO_BE = 0x3023,
SENSOR_PIXEL_FMT_SBGGR12_2X8_PADLO_LE = 0x3024,
/* JPEG compressed formats - next is 0x4002 */
SENSOR_PIXEL_FMT_JPEG_1X8 = 0x4001,
/* Vendor specific formats - next is 0x5002 */
/* S5C73M3 sensor specific interleaved UYVY and JPEG */
SENSOR_PIXEL_FMT_S5C_UYVY_JPEG_1X8 = 0x5001,
/* HSV - next is 0x6002 */
SENSOR_PIXEL_FMT_AHSV8888_1X32 = 0x6001,
} sensor_pixel_fmt;
#define sensor_fmt_is_8BIT(fmt) ( (fmt == SENSOR_PIXEL_FMT_Y8_1X8) || \
(fmt == SENSOR_PIXEL_FMT_SBGGR8_1X8) || \
(fmt == SENSOR_PIXEL_FMT_SGBRG8_1X8) || \
(fmt == SENSOR_PIXEL_FMT_SGRBG8_1X8) || \
(fmt == SENSOR_PIXEL_FMT_SRGGB8_1X8) )
#define sensor_fmt_is_YUV422(fmt) ( (fmt == SENSOR_PIXEL_FMT_UYVY8_2X8) || \
(fmt == SENSOR_PIXEL_FMT_VYUY8_2X8) || \
(fmt == SENSOR_PIXEL_FMT_YUYV8_2X8) || \
(fmt == SENSOR_PIXEL_FMT_YVYU8_2X8) || \
(fmt == SENSOR_PIXEL_FMT_UYVY8_1X16) || \
(fmt == SENSOR_PIXEL_FMT_VYUY8_1X16) || \
(fmt == SENSOR_PIXEL_FMT_YUYV8_1X16) || \
(fmt == SENSOR_PIXEL_FMT_YVYU8_1X16) || \
(fmt == SENSOR_PIXEL_FMT_YDYUYDYV8_1X16) )
#define camera_fmt_is_8BIT(fmt) ( (fmt == CAMERA_PIX_FMT_GREY) || \
(fmt == CAMERA_PIX_FMT_SBGGR8) || \
(fmt == CAMERA_PIX_FMT_SGBRG8) || \
(fmt == CAMERA_PIX_FMT_SGRBG8) || \
(fmt == CAMERA_PIX_FMT_SRGGB8))
#define camera_fmt_is_16BIT(fmt) ( (fmt == CAMERA_PIX_FMT_Y16) || \
(fmt == CAMERA_PIX_FMT_SBGGR16) || \
(fmt == CAMERA_PIX_FMT_SGBRG16) || \
(fmt == CAMERA_PIX_FMT_SGRBG16) || \
(fmt == CAMERA_PIX_FMT_SRGGB16))
#define camera_fmt_is_NV12(fmt) ( (fmt == CAMERA_PIX_FMT_NV12) || \
(fmt == CAMERA_PIX_FMT_NV21) || \
(fmt == CAMERA_PIX_FMT_YVU420) || \
(fmt == CAMERA_PIX_FMT_JZ420B) )
#define camera_fmt_is_YUV422(fmt) ( (fmt == CAMERA_PIX_FMT_YUYV) || \
(fmt == CAMERA_PIX_FMT_YYUV) || \
(fmt == CAMERA_PIX_FMT_YVYU) || \
(fmt == CAMERA_PIX_FMT_UYVY) || \
(fmt == CAMERA_PIX_FMT_VYUY) || \
(fmt == CAMERA_PIX_FMT_YUV422P) || \
(fmt == CAMERA_PIX_FMT_YUV411P) )
#endif /* _CAMERA_PIXEL_FORMAT_H_ */

View File

@ -1,59 +0,0 @@
#ifndef __LIBHARDWARE2_DBOX_H__
#define __LIBHARDWARE2_DBOX_H__
typedef enum {
DBOX_COLOR_RED, /* red */
DBOX_COLOR_BLACK, /* black */
DBOX_COLOR_GREEN, /* green */
DBOX_COLOR_YELLOW, /* yellow */
}dbox_color_t;
typedef enum {
DBOX_MODE_RECT, /* draw rectangle window*/
DBOX_MODE_RANGE, /* draw the corner window*/
DBOX_MODE_HORI, /* draw horizontal line*/
DBOX_MODE_VERT, /* draw vertical line*/
}dbox_mode_t;
typedef struct {
unsigned int start_point_x;
unsigned int start_point_y;
unsigned int box_width;
unsigned int box_height;
unsigned int line_width;
unsigned int line_lenght; /* only used in DBOX_MODE_RANGE */
unsigned int box_mode;
dbox_color_t color_mode;
}dbox_ram_t;
typedef struct {
unsigned int box_pbuf;
unsigned int img_w;
unsigned int img_h;
unsigned int boxs_num;
unsigned int is_rgba;
dbox_ram_t ram_para[24];
}dbox_param_t;
/**
* @brief dbox设备句柄
* @return ,-1
*/
int dbox_open(void);
/**
* @brief dbox设备句柄
* @param fd dbox设备句柄,dbox_open()
* @return 0,-1
*/
int dbox_close(int fd);
/**
* @brief dbox绘制
* @param dbox_fd dbox设备句柄,dbox_open()
* @param dbox_para dbox的信息指针,
* @return 0,0
*/
int dbox_start_draw(const int fd, const dbox_param_t *dbox_param);
#endif /* __LIBHARDWARE2_DBOX_H__ */

View File

@ -1,19 +0,0 @@
#ifndef __LIBHARDWARE2_DTRNG_H__
#define __LIBHARDWARE2_DTRNG_H__
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief DTRNG
* @param value
* @return 0
*/
int dtrng_get_random_number(unsigned int *value);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,63 +0,0 @@
#ifndef __LIBHARDWARE2_EFUSE_H__
#define __LIBHARDWARE2_EFUSE_H__
#ifdef __cplusplus
extern "C" {
#endif
/**
* @info:efuse每个段信息
* @seg_start:
* @seg_size:
* @segment_name:
*/
struct efuse_segment_info {
unsigned int seg_start;
unsigned int seg_size;
char *segment_name;
};
/**
* @brief efuse
* @param name
* @param wr_buf
* @param start
* @param size
* @return 0-1
*/
int efuse_write(char *name, unsigned char *wr_buf, int start, int size);
/**
* @brief efuse
* @param name
* @param buf
* @param start
* @param size
* @return 0-1
*/
int efuse_read(char *name, unsigned char *buf, int start, int size);
/**
* @brief efuse某一段的大小
* @param name
* @return -1
*/
int efuse_read_seg_size(char *name);
/**
* @brief efuse每个段的信息
* @return efuse每个段信息的结构体segment_name为NULLNULL
*/
struct efuse_segment_info *efuse_get_segment_information(void);
/**
* @brief efuse每个段信息时所申请的空间
* @param list efuse每个段信息的结构体
*/
void efuse_free_information(struct efuse_segment_info *info);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,176 +0,0 @@
#ifndef __LIBHARDWARE2_FB_H__
#define __LIBHARDWARE2_FB_H__
#include <linux/fb.h>
#include <sys/mman.h>
#ifdef __cplusplus
extern "C" {
#endif
enum fb_fmt {
fb_fmt_RGB555,
fb_fmt_RGB565,
fb_fmt_RGB888,
fb_fmt_ARGB8888,
fb_fmt_NV12,
fb_fmt_NV21,
fb_fmt_yuv422,
};
struct fb_device_info {
unsigned int xres;
unsigned int yres;
enum fb_fmt fb_fmt;
unsigned int line_length;
unsigned int bits_per_pixel;
unsigned int frame_size;
unsigned int frame_nums;
void *mapped_mem;
struct fb_fix_screeninfo fix;
struct fb_var_screeninfo var;
};
/* 计算每个像素点所占字节数 */
unsigned int fb_bytes_per_pixel(enum fb_fmt fb_fmt);
/**
* @brief fb设备句柄
* @param dev_path fb设备路径,/dev/fb0
* @param info fb信息结构体,NULL
* @return ,-1
*/
int fb_open(const char *dev_path, struct fb_device_info *info);
/**
* @brief fb设备句柄
* @param fd fb设备句柄,fb_open()
* @param info fb的信息,fb_open()
* @return 0,-1
*/
int fb_close(int fd, struct fb_device_info *info);
/**
* @brief 使fb设备,
* @param fd fb设备句柄,fb_open()
* @return 0,
*/
int fb_enable(int fd);
/**
* @brief fb设备,
* @param fd fb设备句柄,fb_open()
* @return 0,
*/
int fb_disable(int fd);
/**
* @brief /fb指定的帧
* @param fd fb设备句柄,fb_open()
* @param info fb的信息,fb_open()
* @param frame_index ,0 (info.frame_nums - 1)
* @return 0,
*/
int fb_pan_display(int fd, struct fb_device_info *info, unsigned int frame_index);
/*
* x1830 layer叠加的功能,NV12格式的显示
*/
enum lcdc_layer_order {
lcdc_layer_top,
lcdc_layer_bottom,
lcdc_layer_0,
lcdc_layer_1,
lcdc_layer_2,
lcdc_layer_3,
};
struct lcdc_layer {
/* layer 的格式 */
enum fb_fmt fb_fmt;
/* layer 的大小 */
unsigned int xres;
unsigned int yres;
/* layer 在屏幕上的偏移 */
unsigned int xpos;
unsigned int ypos;
/* layer 的所在的层级 */
enum lcdc_layer_order layer_order;
/* 是否使能 layer */
int layer_enable;
/* rgb 格式时使用 */
struct {
void *mem;
unsigned int stride; // 单位: 字节
} rgb;
/* NV12,NV21 格式时使用 */
struct {
void *mem;
unsigned int stride; // 单位: 字节
} y;
/* NV12,NV21 格式时使用 */
struct {
void *mem;
unsigned int stride; // 单位: 字节
} uv;
struct {
unsigned char enable;
unsigned char value;
} alpha;
struct {
unsigned char enable;
unsigned int xres;
unsigned int yres;
} scaling;
};
/**
* @brief pan display
* @param fd fb设备句柄,fb_open()
* @return 0,
*/
int fb_pan_display_enable_user_cfg(int fd);
/**
* @brief pan display
* @param fd fb设备句柄,fb_open()
* @return 0,
*/
int fb_pan_display_disable_user_cfg(int fd);
/**
* @brief
* @param fd fb设备句柄,fb_open()
* @param cfg lcd layer的设置
* @return 0,
*/
int fb_pan_display_set_user_cfg(int fd, struct lcdc_layer *cfg);
/**
* @brief slcd寄存器的值
* @param fd fb设备句柄,fb_open()
* @param reg
* @param buffer
* @param count
* @return 0,
*/
int fb_slcd_read_reg_8(int fd, int reg, char *buffer, int count);
#ifdef __cplusplus
}
#endif
#endif /* __LIBHARDWARE2_FB_H__ */

View File

@ -1,54 +0,0 @@
#ifndef __LIBHARDWARE2_FB_LAYER_MIXER_H__
#define __LIBHARDWARE2_FB_LAYER_MIXER_H__
#include "fb.h"
#include <sys/mman.h>
#ifdef __cplusplus
extern "C" {
#endif
struct fb_layer_mixer_output_cfg {
int xres;
int yres;
enum fb_fmt format;
void *dst_mem;
void *dst_mem_virtual;
};
/**
* @brief fb_layer_mixer
* @param cfg mixer的配置信息
* @return mixer句柄,
*/
int fb_layer_mixer_create(struct fb_layer_mixer_output_cfg *cfg);
/**
* @brief mixer输入图层的参数
* @param fd mixer的操作句柄fb_layer_mixer_create
* @param layer_id 0~3
* @param layer
* @return 0,
*/
int fb_layer_mixer_set_input_layer(int fd, int layer_id, struct lcdc_layer *layer);
/**
* @brief 使mixer输出一帧数据
* @param fd mixer的操作句柄fb_layer_mixer_create
* @return 0,
*/
int fb_layer_mixer_work_out_one_frame(int fd);
/**
* @brief mixer
* @param fd mixer的操作句柄fb_layer_mixer_create
* @return
*/
void fb_layer_mixer_delete(int fd);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,88 +0,0 @@
/*
* Copyright (C) 2020 Ingenic Semiconductor Co., Ltd.
*
* Ingenic library hardware version2
*
*/
#ifndef __HARDWARE2_GPIO_H__
#define __HARDWARE2_GPIO_H__
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief gpio设备句柄
* @return ,
*/
int gpio_open(void);
/**
* @brief gpio设备句柄
* @param fd gpio设备句柄,gpio_open()
* @return 0,
*/
int gpio_close(int fd);
/**
* @brief gpio功能
* @param fd gpio设备句柄,gpio_open()
* @param gpio gpio引脚"PB08"
* @param funcs gpio功能char *funcs = {"input", "pull_up"};
* @param func_count funcs
* @return 0,
*/
int gpio_set_func(int fd, const char *gpio, char *funcs[], unsigned int func_count);
/**
* @brief gpio当前的功能
* @param fd gpio设备句柄,gpio_open()
* @param gpio gpio引脚"PB08"
* @param buf gpio的功能
* @param buf_size buf的大小
* @return 0,
*/
int gpio_get_func(int fd, const char *gpio, char *buf, int buf_size);
/**
* @brief gpio当前的功能 gpio_set_func
* @param fd gpio设备句柄,gpio_open()
* @param gpio gpio引脚"PB08"
* @param buf buf ,buf获取gpio的一个功能
* @param buf_count buf buf的个数
* @param buf_size buf buf的大小,buf大小都一样大
* @return ,
*/
int gpio_get_func2(int fd, const char *gpio, char *buf[], int buf_count, int buf_size);
/**
* @brief gpio输入的值
* @param fd gpio设备句柄,gpio_open()
* @param gpio gpio引脚"PB08"
* @return 01,
*/
int gpio_get_value(int fd, const char *gpio);
/**
* @brief gpio输入的值
* @param fd gpio设备句柄,gpio_open()
* @param gpio gpio引脚"PB08"
* @param value 0 1
* @return 01,
*/
int gpio_set_value(int fd, const char *gpio, int value);
/**
* @brief gpio的帮助信息
* @param fd gpio设备句柄,gpio_open()
* @param buf gpio的帮助信息
* @param buf_size buf的大小
* @return 01,
*/
int gpio_get_help(int fd, char *buf, unsigned int buf_size);
#ifdef __cplusplus
}
#endif
#endif /* __HARDWARE2_GPIO_H__ */

View File

@ -1,79 +0,0 @@
#ifndef _LIBHARDWARE2_GPIO_COUNTER_H
#define _LIBHARDWARE2_GPIO_COUNTER_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief gpio设备句柄
* @return ,
*/
int gpio_counter_open(void);
/**
* @brief gpio设备句柄
* @param fd gpio_counter设备句柄,gpio_counter_open()
* @return 0,
*/
int gpio_counter_close(int fd);
/**
* @brief gpio_counter
* @param fd gpio_counter设备句柄gpio_counter_open()
* @param channel_id gpio_counter捕获通道号
* @param mode_name ,gpio_counter_get_mode_information获得支持的模式.
* @return 0
*/
int gpio_counter_config(int fd, int channel_id, char *mode_name);
/**
* @brief 使gpio_counter设备
* @param fd gpio_counter设备句柄,gpio_counter_open()
* @return 0,
*/
int gpio_counter_enable(int fd, unsigned int channel_id);
/**
* @brief gpio_counter设备
* @param fd gpio_counter设备句柄,gpio_counter_open()
* @return 0,
*/
int gpio_counter_disable(int fd, unsigned int channel_id);
/**
* @brief
* @param fd gpio_counter设备句柄,gpio_counter_open()
* @return ,
*/
int gpio_counter_get_count(int fd, int channel_id);
/**
* @brief
* @param fd gpio_counter设备句柄,gpio_counter_open()
* @param channel_id gpio_counter捕获通道号
* @param high_level_time
* @param period_time
* @return 0,
*/
int gpio_counter_get_capture(int fd, int channel_id, int *high_level_time, int *period_time);
/**
* @brief gpio_counter控制器支持的
* @param fd gpio_counter设备句柄,gpio_counter_open()
* @param num gpio_counter控制器支持的模式数量
* @return :,NULL.
*/
char **gpio_counter_get_mode_information(int fd, int *num);
/**
* @brief gpio_counter_get_mode_information申请的内存.
* @param array gpio_counter_get_mode_information的返回值
*/
void gpio_counter_free_mode_information(char **array);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,93 +0,0 @@
#ifndef _GPIO_SYS_H_
#define _GPIO_SYS_H_
#ifdef __cplusplus
extern "C" {
#endif
#define GPIO_PA(n) (32*0 + n)
#define GPIO_PB(n) (32*1 + n)
#define GPIO_PC(n) (32*2 + n)
#define GPIO_PD(n) (32*3 + n)
#define GPIO_PE(n) (32*4 + n)
typedef enum _gpio_irq_mode {
GPIO_NONE,
GPIO_RISING,
GPIO_FALLING,
GPIO_BOTH,
} gpio_irq_mode;
/**
* @bref gpio
* @param gpio gpio pin
* @return 0
*/
int gpio_sys_request(unsigned int gpio);
/**
* @bref gpio
* @param gpio gpio pin
* @return 0
*/
int gpio_sys_free(unsigned int gpio);
/**
* @bref gpio值
* @param gpio gpio pin
* @return 01gpio的值
*/
int gpio_sys_get_value(unsigned int gpio);
/**
* @bref gpio的值
* @param gpio gpio pin
* @param val val=[0,1]
* @return 0
*/
int gpio_sys_set_value(unsigned int gpio, int val);
/**
* @bref gpio为输入模式
* @param gpio gpio pin
* @return 0
*/
int gpio_sys_direction_input(unsigned int gpio);
/**
* @bref gpio输出电平
* @param gpio gpio pin
* @param value value=[0,1]
* @return 0
*/
int gpio_sys_direction_output(unsigned int gpio, int value);
/**
* @bref 使gpio中断
* @param gpio gpio pin
* @param irq_mode
* @return 0
*/
int gpio_sys_enable_irq(unsigned int gpio, gpio_irq_mode irq_mode);
/**
* @bref gpio中断触发
* @param gpio gpio pin
* @param timeout_ms
* @return 01gpio的值
*/
int gpio_sys_irq_wait_timeout(
unsigned int gpio, int timeout_ms);
/**
* @bref gpio中断触发
* @param gpio gpio pin
* @return 01gpio的值
*/
int gpio_sys_irq_wait(unsigned int gpio);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,54 +0,0 @@
#ifndef __LIBHARDWARE2_HASH_H__
#define __LIBHARDWARE2_HASH_H__
#ifdef __cplusplus
extern "C" {
#endif
#define CMD_hash_init _IOWR('h', 0, int)
#define CMD_hash_write _IOWR('h', 1, unsigned long)
#define CMD_hash_deinit _IOWR('h', 2, unsigned long)
#define MD5_byte 16
#define SHA1_byte 20
#define SHA224_byte 28
#define SHA256_byte 32
enum encryption_mode {
MD5,
SHA1,
SHA224,
SHA256,
};
/**
* NOTE:hash_write
* hash_init,
* hash_init -> hash_write -> hash_deinit
*/
/**
* @brief hash加密模式并获取文件描述符
* @param mode MD5,SHA1,SHA224,SHA256
* @return
*/
int hash_init(enum encryption_mode mode);
/**
* @brief
* @param handle
* @param str
* @param str_size
* @return 0
*/
int hash_write(int handle,unsigned char *str,int str_size);
/**
* @brief
* @param handle
* @param rec
* @param hash_size
* @return 0
*/
int hash_deinit(int handle,unsigned char *rec,unsigned long hash_size);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,115 +0,0 @@
/*
* Copyright (C) 2020 Ingenic Semiconductor Co., Ltd.
*
* Ingenic library hardware version2
*
*/
#ifndef __HARDWARE2_I2C_H__
#define __HARDWARE2_I2C_H__
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief i2c设备
* @param bus_num i2c总线号
* @return >0 : i2c文件描述符i2c_fd
* <0 : ()
*/
int i2c_open(int bus_num);
/**
* @brief i2c设备
* @param i2c_fd i2c设备文件描述符
* @return
*/
void i2c_close(int i2c_fd);
/**
* @brief i2c设备
* @param i2c_fd i2c设备文件描述符
* @param device_addr i2c设备地址
* @return =1
* =0
* <0
*/
int i2c_detect(int i2c_fd, uint16_t device_addr);
/**
* @brief i2c读
* @param i2c_fd i2c设备文件描述符
* @param device_addr i2c设备地址
* @param buffer buffer
* @param size buffer大小
* @return =0
* <0
*/
int i2c_read(int i2c_fd, uint16_t device_addr, void *buffer, int size);
/**
* @brief i2c写
* @param i2c_fd i2c设备文件描述符
* @param device_addr i2c设备地址
* @param buffer buffer
* @param size buffer大小
* @return =0
* <0
*/
int i2c_write(int i2c_fd, uint16_t device_addr, void *buffer, int size);
/**
* @brief i2c读寄存器(8bit)
* @param i2c_fd i2c设备文件描述符
* @param device_addr i2c设备地址
* @param reg_addr (8bit)
* @param buffer buffer
* @param size buffer大小
* @return =0
* <0
*/
int i2c_read_reg(int i2c_fd, uint16_t device_addr, uint8_t reg_addr,void *buffer, int size);
/**
* @brief i2c写寄存器(8bit)
* @param i2c_fd i2c设备文件描述符
* @param device_addr i2c设备地址
* @param reg_addr (8bit)
* @param buffer buffer
* @param size buffer大小
* @return =0
* <0
*/
int i2c_write_reg(int i2c_fd, uint16_t device_addr, uint8_t reg_addr,void *buffer, int size);
/**
* @brief i2c读寄存器(16bit)
* @param i2c_fd i2c设备文件描述符
* @param device_addr i2c设备地址
* @param reg_addr (16bit)
* @param buffer buffer
* @param size buffer大小
* @return =0
* <0
*/
int i2c_read_reg_16(int i2c_fd, uint16_t device_addr, uint16_t reg_addr,void *buffer, int size);
/**
* @brief i2c写寄存器(16bit)
* @param i2c_fd i2c设备文件描述符
* @param device_addr i2c设备地址
* @param reg_addr (16bit)
* @param buffer buffer
* @param size buffer大小
* @return =0
* <0
*/
int i2c_write_reg_16(int i2c_fd, uint16_t device_addr, uint16_t reg_addr,void *buffer, int size);
#ifdef __cplusplus
}
#endif
#endif //__HARDWARE_I2C_H__

View File

@ -1,66 +0,0 @@
#ifndef __LIBHARDWARE2_SC_H__
#define __LIBHARDWARE2_SC_H__
#ifdef __cplusplus
extern "C" {
#endif
/*
* sc decrypted.
* prepare a src_file encrypted.
* |---------------|-------------------| |
* | SC KEY(2048) | data encrypted |
* |---------------|-------------------| |
*
* */
/* size per round must be align with 64, it can be different from kernel,
* it doesn't matter when more than 2048 or less */
#define SC_MAX_SIZE_PERROUND 2048
/* be same with kernel */
#define SC_SIGNATURE_SIZE 2048
/**
* @brief sc设备获得sc设备句柄, kernel内menuconfig内选中INGENIC_SC
* @return sc设备句柄
*/
int sc_open(void);
/**
* @brief fd关闭sc设备
* @param fd sc设备句柄
* @return
*/
void sc_close(int fd);
/**
* @brief head地址获取信息并设置密钥等签名信息,
* @param fd sc设备句柄
* @param head , 2048
* @return ,
*/
int sc_setup(int fd, unsigned char *head);
/**
* @brief : src位置大小为size的数据解密, dst位置
* @param fd sc设备句柄
* @param src
* @param dst
* @param size
* @return 0,
*/
int sc_decrypt(int fd, unsigned char *src, unsigned char *dst, int size);
/**
* @brief in_file文件内容并将结果保存在out_file内
* @param fd sc设备句柄
* @param in_file , (使other bin方式勾选上AES及SIGNUTARE)
* @param out_file
* @return 0,
*/
int sc_decrypt_file(int fd, unsigned char *in_file, unsigned char *out_file);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,65 +0,0 @@
#ifndef __LIBHARDWARE2_IPU_H__
#define __LIBHARDWARE2_IPU_H__
#define IPU_CMD_OSD_CH0 (0)
#define IPU_CMD_OSD_CH1 (1)
#define IPU_CMD_OSD_CH2 (2)
#define IPU_CMD_OSD_CH3 (3)
#define IPU_OSD_CH_INDEX_MIN (0)
#define IPU_OSD_CH_INDEX_MAX (3)
#define IPU_CMD_CSC_FLAG (1<<4)
#define IPU_CMD_OSD_FLAG (0xf)
#define IPU_OSD_CHX_PARA_CSCCTL_SET(p, x) ((p)=(((p)&(~(0x3<<24)))|((x&0x3)<<24)))
#define IPU_OSD_CHX_PARA_ALPHA_SET(p, x) ((p)=(((p)&(~(0xff<<3)))|((x&0xff)<<3)))
#define IPU_OSD_CHX_PARA_PICTYPE_SET(p, x) ((p)=(((p)&(~(0x7<<11)))|((x&0x7)<<11)))
#define IPU_OSD_CHX_PARA_ARGBTYPE_SET(p, x) ((p)=(((p)&(~(0xf<<14)))|((x&0xf)<<14)))
typedef struct {
unsigned int osd_chx_fmt; /* osd chx input image format */
unsigned int osd_chx_para; /* OSD_CHX_PARA reg value*/
unsigned int osd_chx_bak_argb; /* OSD_CHX_BAK_ARGB reg value */
unsigned int osd_chx_pos_x; /* osd chx input image start_point_x */
unsigned int osd_chx_pos_y; /* osd chx input image start_point_y */
unsigned int osd_chx_src_w; /* osd chx input image's width */
unsigned int osd_chx_src_h; /* osd chx input image's height */
unsigned int osd_chx_buf_phy; /* osd chx input image's physical address must be continuity*/
}ipu_osdx_param_t;
typedef struct {
unsigned int cmd; /* IPU command */
unsigned int bg_w; /* background weight */
unsigned int bg_h; /* background hight */
unsigned int bg_fmt; /* background format */
unsigned int bg_buf_phy; /* background buffer physical addr */
unsigned int out_fmt; /* out format */
ipu_osdx_param_t ipu_osdx_param[IPU_OSD_CH_INDEX_MAX+1];
}ipu_param_t;
/**
* @brief ipu设备句柄
* @return ,-1
*/
int ipu_open(void);
/**
* @brief ipu设备句柄
* @param fd ipu设备句柄,ipu_open()
* @return 0,-1
*/
int ipu_close(int fd);
/**
* @brief ipu绘制
* @param ipu_fd ipu设备句柄,ipu_open()
* @param ipu_param ipu的信息指针,
* @return 0,0
*/
int ipu_start_draw(const int fd, const ipu_param_t *ipu_param);
#endif /* __LIBHARDWARE2_IPU_H__ */

View File

@ -1,36 +0,0 @@
#ifndef __IPU_UTILS_H_
#define __IPU_UTILS_H_
/* match ipu driver define */
typedef enum {
HAL_PIXEL_FORMAT_RGBA_8888 = 1,
HAL_PIXEL_FORMAT_RGBX_8888 = 2,
HAL_PIXEL_FORMAT_RGB_888 = 3,
HAL_PIXEL_FORMAT_RGB_565 = 4,
HAL_PIXEL_FORMAT_BGRA_8888 = 5,
//HAL_PIXEL_FORMAT_BGRX_8888 = 0x8000, /* Add BGRX_8888, Wolfgang, 2010-07-24 */
HAL_PIXEL_FORMAT_BGRX_8888 = 0x1ff, /* 2012-10-23 */
HAL_PIXEL_FORMAT_RGBA_5551 = 6,
HAL_PIXEL_FORMAT_RGBA_4444 = 7,
HAL_PIXEL_FORMAT_ABGR_8888 = 8,
HAL_PIXEL_FORMAT_ARGB_8888 = 9,
HAL_PIXEL_FORMAT_YCbCr_422_SP = 0x10,
HAL_PIXEL_FORMAT_YCbCr_420_SP = 0x11,
HAL_PIXEL_FORMAT_YCbCr_422_P = 0x12,
HAL_PIXEL_FORMAT_YCbCr_420_P = 0x13,
HAL_PIXEL_FORMAT_YCbCr_420_B = 0x24,
HAL_PIXEL_FORMAT_YCbCr_422_I = 0x14,
HAL_PIXEL_FORMAT_YCbCr_420_I = 0x15,
HAL_PIXEL_FORMAT_CbYCrY_422_I = 0x16,
HAL_PIXEL_FORMAT_CbYCrY_420_I = 0x17,
HAL_PIXEL_FORMAT_NV12 = 0x18,
HAL_PIXEL_FORMAT_NV21 = 0x19,
HAL_PIXEL_FORMAT_BGRA_5551 = 0x1a,
HAL_PIXEL_FORMAT_HSV = 0x1b,
/* suport for YUV420 */
HAL_PIXEL_FORMAT_JZ_YUV_420_P = 0x47700001, // YUV_420_P
HAL_PIXEL_FORMAT_JZ_YUV_420_B = 0x47700002, // YUV_420_P BLOCK MODE
}piexl_format_t;
#endif /* __IPU_UTILS_H_ */

View File

@ -1,62 +0,0 @@
#ifndef __LIBHARDWARE2_JPEGD_DECODE_H__
#define __LIBHARDWARE2_JPEGD_DECODE_H__
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
JPEGD_PIX_FMT_NV12 = 0,
JPEGD_PIX_FMT_NV21 = 1,
JPEGD_PIX_FMT_BGRA_8888 = 12,
JPEGD_PIX_FMT_RGB_888 = 16,
JPEGD_PIX_FMT_YUYV = 41,
JPEGD_PIX_FMT_YUV444 = 45,
} jpegd_pixel_fmt;
/* 解码前传入的相关参数 */
struct jpegd_decoder_config {
unsigned int file_size; // jpg图片文件大小
int width; // jpg图片的宽
int height; // jpg图片的高
jpegd_pixel_fmt out_fmt; // 解码后图像目标格式
void *input_mem; // 待解码的源数据地址
};
/* 解码后传出的相关数据 */
struct jpegd_decoder_output_data{
void *mem; // 解码后的目标数据地址
int image_size; // 解码后的目标数据大小
int image_width; // 解码后图像的宽
int image_height; // 解码后图像的宽
unsigned long phy_mem; // dst_buf物理地址
int buff_size; // dst_buff的大小
};
/* 将jpeg decoder作为设备打开返回设备句柄 */
struct jpegd_decoder *jpegd_decoder_open(void);
/* 关闭jpeg decoder */
void jpegd_decoder_close(struct jpegd_decoder *decoder);
/**
* @brief
* @param decoder decoder设备句柄
* @param input
* @param output
* @return 0,-1
*/
int jpegd_decoder_get(struct jpegd_decoder *decoder, struct jpegd_decoder_config *input, struct jpegd_decoder_output_data *output);
/**
* @brief
* @param decoder decoder设备句柄
* @param output
* @return
*/
void jpegd_decoder_put(struct jpegd_decoder *decoder , struct jpegd_decoder_output_data *output);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,63 +0,0 @@
#ifndef __LIBHARDWARE2_JPEGE_ENCODE_H__
#define __LIBHARDWARE2_JPEGE_ENCODE_H__
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
JPEGE_PIX_FMT_NV12 = 0,
JPEGE_PIX_FMT_NV21 = 1,
JPEGE_PIX_FMT_RGBA_8888 = 10,
JPEGE_PIX_FMT_BGRA_8888 = 12,
JPEGE_PIX_FMT_RGB_888 = 16,
JPEGE_PIX_FMT_YUYV = 41,
JPEGE_PIX_FMT_YUV444 = 45,
} jpege_pixel_fmt;
/* 编码前传入的相关参数 */
struct jpege_encoder_config {
unsigned int file_size; // 图像的源文件大小
int qa; // 压缩等级
int width; // 图像的宽
int height; // 图像的高
jpege_pixel_fmt in_fmt; // 编码前图像源格式
void *input_mem; // 待编码的源数据地址
};
/* 编码后传出的相关数据 */
struct jpege_encoder_output_data{
void *mem; // 编码后的目标数据地址
int image_size; // 编码后的目标数据大小
unsigned long phy_mem; // dst_buf物理地址
int buff_size; // dst_buff的大小
};
/* 将jpeg encoder作为设备打开返回设备句柄 */
struct jpege_encoder *jpege_encoder_open(void);
/* 关闭jpeg encoder */
void jpege_encoder_close(struct jpege_encoder *encoder);
/**
* @brief
* @param encoder encoder设备句柄
* @param input
* @param output
* @return 0,-1
*/
int jpege_encoder_get(struct jpege_encoder *encoder, struct jpege_encoder_config *input, struct jpege_encoder_output_data *output);
/**
* @brief
* @param encoder encoder设备句柄
* @param output
* @return
*/
void jpege_encoder_put(struct jpege_encoder *encoder , struct jpege_encoder_output_data *output);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,42 +0,0 @@
#ifndef __LIBHARDWARE2_KEYBOARD_H__
#define __LIBHARDWARE2_KEYBOARD_H__
#ifdef __cplusplus
extern "C" {
#endif
struct key_event {
int key_type;
int is_press;
};
/**
* @brief
* @return
* -1
*/
long keys_open(void);
/**
* @brief
* @param handle keys_open()
*/
void keys_close(long handle);
/**
* @brief
* @param handle keys_open()
* @param key_event
* @param timeout (-1 0 0)
* @return 0 / poll错误
* 1
* 0
*/
int read_key_event(long handle, struct key_event *key_event, int timeout);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,42 +0,0 @@
#ifndef _LIBHARDWARE2_H_
#define _LIBHARDWARE2_H_
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif
int mcu_open(void);
int mcu_close(int mcu_fd);
int mcu_shutdown(int mcu_fd);
int mcu_reset(int mcu_fd);
int mcu_bootup(int mcu_fd);
int mcu_write_mem(int mcu_fd, unsigned int offset, void *src, int len);
int mcu_write_firmware2(int mcu_fd, FILE *firmware_file);
int mcu_write_firmware(int mcu_fd, const char *firmware_path);
int mcu_write_data(int mcu_fd, void *src, int len);
int mcu_read_data(int mcu_fd, void *src, int len);
int mcu_read_str(int mcu_fd, void *src, int len);
int mcu_read_str_timeout(int mcu_fd, void *src, int len, unsigned long us);
int mcu_write_data_timeout(int mcu_fd, void *src, int len, unsigned long us);
int mcu_read_data_timeout(int mcu_fd, void *dst, int len, unsigned long us);
#ifdef __cplusplus
}
#endif
#endif /* _LIBHARDWARE2_H_ */

View File

@ -1,137 +0,0 @@
#ifndef __LIBHARDWARE2_MSCALER_H__
#define __LIBHARDWARE2_MSCALER_H__
#ifdef __cplusplus
extern "C" {
#endif
/*
* 31 23 15 7 0
* A R G B
* MSCALER_FORMAT_BGRA_8888
* BRGA格式时
* 0B1G2R3A
*/
enum mscaler_fmt{
MSCALER_FORMAT_NV12 = 0,
MSCALER_FORMAT_NV21 = 1,
MSCALER_FORMAT_BGRA_8888 = (0<<2)+2,
MSCALER_FORMAT_GBRA_8888 = (1<<2)+2,
MSCALER_FORMAT_RBGA_8888 = (2<<2)+2,
MSCALER_FORMAT_BRGA_8888 = (3<<2)+2,
MSCALER_FORMAT_GRBA_8888 = (4<<2)+2,
MSCALER_FORMAT_RGBA_8888 = (5<<2)+2,
MSCALER_FORMAT_ABGR_8888 = (8<<2)+2,
MSCALER_FORMAT_AGBR_8888 = (9<<2)+2,
MSCALER_FORMAT_ARBG_8888 = (10<<2)+2,
MSCALER_FORMAT_ABRG_8888 = (11<<2)+2,
MSCALER_FORMAT_AGRB_8888 = (12<<2)+2,
MSCALER_FORMAT_ARGB_8888 = (13<<2)+2,
MSCALER_FORMAT_BGR_565 = (0<<2)+3,
MSCALER_FORMAT_GBR_565 = (1<<2)+3,
MSCALER_FORMAT_RBG_565 = (2<<2)+3,
MSCALER_FORMAT_BRG_565 = (3<<2)+3,
MSCALER_FORMAT_GRB_565 = (4<<2)+3,
MSCALER_FORMAT_RGB_565 = (5<<2)+3,
};
struct mscaler_frame_part
{
/* 用户空间虚拟地址 */
void *mem;
/* 分量大小 cache_line对齐 */
unsigned int mem_size;
/* 实际物理地址,必须 cache_line 对齐 */
unsigned long phys_addr;
/* 行字节对齐要求必须同时满足MSCALER_ALIGN对齐 */
unsigned int stride;
};
struct mscaler_frame
{
/* 输入图像格式只支持 nv12/nv21 输出图像格式全支持mscaler_fmt */
enum mscaler_fmt fmt;
/* 图像宽 */
unsigned int xres;
/* 图像高 */
unsigned int yres;
/* mscaler_fmt全格式使用rgb/rgba等格式只需要使用y分量即可 */
struct mscaler_frame_part y;
/* NV12,NV21 格式时使用,uv分量 */
struct mscaler_frame_part uv;
};
struct mscaler_device_info
{
/* 一行数据需要对齐的大小,单位: 字节 */
unsigned int stride_align;
/* 一帧数据需要对齐的大小,单位: 字节 */
unsigned int frame_align;
/* 申请的物理内存地址 */
unsigned long phys_addr;
/* 申请的内存空间对齐之后的大小 */
unsigned int mem_align_size;
/* 申请的用户空间内存地址 */
void *mapped_mem;
};
/**
* @brief mscaler设备句柄
* @param info mscaler信息结构体,NULL,stride_alignframe_align被赋值
* @return ,-1
*/
int mscaler_open(struct mscaler_device_info *info);
/**
* @brief mscaler设备句柄
* @param fd mscaler设备句柄,mscaler_open()
* @return 0,-1
*/
int mscaler_close(int fd);
/**
* @brief mscaler申请需要的空间大小
* @param fd mscaler设备句柄,mscaler_open()
* @param info mscaler的信息,,phys_addrmem_align_sizemapped_mem被赋值
* @param mem_size
* @return 0,-1
*/
int mscaler_alloc_mem(int fd, struct mscaler_device_info *info, int mem_size);
/**
* @brief mscaler_alloc_mem申请的内存空间
* @param fd mscaler设备句柄,mscaler_open()
* @param info mscaler的信息,
* @return 0,-1
*/
int mscaler_free_mem(int fd, struct mscaler_device_info *info);
/**
* @brief
* @param fd mscaler设备句柄,mscaler_open()
* @param src
* @param dst
* @return 0,-1
*/
int mscaler_convert(int fd, struct mscaler_frame *src, struct mscaler_frame *dst);
#ifdef __cplusplus
}
#endif
#endif//__LIBHARDWARE2_MSCALER_H__

View File

@ -1,28 +0,0 @@
#ifndef __LIBHARDWARE2_NEMC_H__
#define __LIBHARDWARE2_NEMC_H__
#ifdef __cplusplus
extern "C" {
#endif
struct nemc_timing {
uint32_t tas; /* Tas */
uint32_t taw; /* Taw */
uint32_t tbp; /* Tbp */
uint32_t tah; /* Tah */
uint32_t strv; /* strv */
};
int nemc_open(const char *dev_path, void **mem);
int nemc_set_timing(int fd, struct nemc_timing *timing);
int nemc_get_timeing(int fd, struct nemc_timing *timing);
void nemc_close(int fd, void *mem);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,26 +0,0 @@
#ifndef _LIBHARDWARE2_GPIO_PS2_H_
#define _LIBHARDWARE2_GPIO_PS2_H_
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif
int ps2_read_raw_byte(int fd, unsigned char *data);
int ps2_read_raw_byte_timeout(int fd, unsigned char *buf, int timeout_ms);
int ps2_write_raw_byte(int fd, unsigned char byte);
int ps2_write_str(int fd, void *buf, int size);
int ps2_open(const char *dev_name);
void ps2_close(int fd);
#ifdef __cplusplus
}
#endif
#endif /* _LIBHARDWARE2_GPIO_PS2_H_ */

View File

@ -1,171 +0,0 @@
#ifndef __LIBHARDWARE2_PWM_H__
#define __LIBHARDWARE2_PWM_H__
#ifdef __cplusplus
extern "C" {
#endif
enum pwm_shutdown_mode {
/**
* pwm停止输出时,pwm的信号结尾是一个完整的周期
*/
PWM_graceful_shutdown,
/**
* pwm停止输出时,pwm设置成空闲时电平
*/
PWM_abrupt_shutdown,
};
enum pwm_idle_level {
/**
* pwm
*/
PWM_idle_low,
/**
* pwm
*/
PWM_idle_high,
};
enum pwm_accuracy_priority {
/**
* pwm的目标频率的精度,
*/
PWM_accuracy_freq_first,
/**
* pwm的级数设置,pwm频率可能不准确
*/
PWM_accuracy_levels_first,
};
struct pwm_config_data {
enum pwm_shutdown_mode shutdown_mode;
enum pwm_idle_level idle_level;
enum pwm_accuracy_priority accuracy_priority;
unsigned long freq;
unsigned long levels;
unsigned int id;
};
/**
* @brief 使PWM通道
* @param channels PWM通道
* @return 0-1
*/
int pwm_enable_channels(unsigned int channels);
/**
* @brief PWM通道
* @param channels PWM通道
* @return 0-1
*/
int pwm_disable_channels(unsigned int channels);
/**
* @brief PWM不是真正的使能
* @param handle pwm_request()
* @return 0-1
*/
int pwm_not_really_enable(long handle);
/**
* @brief PWM不是真正的失能
* @param handle pwm_request()
* @return 0-1
*/
int pwm_not_really_disable(long handle);
/**
* @brief PWM
* @param gpio_name pwm对应的gpio引脚"pb17""pc11"...
* @return -1
*/
long pwm_request(const char *gpio_name);
/**
* @brief PWM
* @param handle pwm_request()
*/
void pwm_release(long handle);
/**
* @brief pwm pwm_config_data
* @param handle pwm_request()
* @param cfg pwm_config_data struct pwm_config_data结构体的定义
* @return 0
*/
int pwm_config(long handle, struct pwm_config_data *cfg);
/**
* @brief PWM
* @param handle pwm_request()
* @param level pwm调制的级数,
* @return 0
*/
int pwm_set_level(long handle, unsigned int level);
/* ---- dma mode ---- */
enum pwm_dma_start_level {
PWM_start_low, /* pwm dma模式的起始电平为低 */
PWM_start_high, /* pwm dma模式的起始电平为高 */
};
/*
: high和low不能为零
pwm2_dma_init返回
*/
struct pwm_data {
/* 低电平个数 */
unsigned low:16;
/* 高电平个数 */
unsigned high:16;
};
/**
* @brief pwm dma模式
* @param handle pwm_request()
* @return pwm频率
*/
int pwm_dma_init(long handle, enum pwm_idle_level idle_level, enum pwm_dma_start_level start_level);
/**
* @brief 使dma数据更新pwm
* @param handle pwm_request()
* @param data dma数据
* @param data_count
* @return 0
*/
int pwm_dma_update(long handle, struct pwm_data *data, unsigned int data_count);
/**
* @brief 使dma发送指定个数的电平
* @param handle pwm_request()
* @param high
* @param low
* @param data_count
* @return 0
*/
int pwm_dma_send(long handle, unsigned short high, unsigned short low, unsigned int data_count);
/**
* @brief 使dma的循环模式
* @param handle pwm_request()
* @param data dma数据
* @param data_count
* @return 0
*/
int pwm_dma_enable_loop(long handle, struct pwm_data *data, unsigned int data_count);
/**
* @brief dma循环
* @param handle pwm_request()
* @return 0
*/
int pwm_dma_disable_loop(long handle);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,34 +0,0 @@
#ifndef __LIBHARDWARE2_PWM_BATTERY_H__
#define __LIBHARDWARE2_PWM_BATTERY_H__
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief pwm检测电压节点
* @param
* @return -1
*/
int pwm_battery_open(void);
/**
* @brief (mv)
* @param
* @return -1
*/
int pwm_battery_read(int fd);
/**
* @brief
* @param
* @return
*/
void pwm_battery_close(int fd);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,29 +0,0 @@
#ifndef __LIBHARDWARE2_RMEM_H__
#define __LIBHARDWARE2_RMEM_H__
#ifdef __cplusplus
extern "C" {
#endif
struct rmem_alloc_data {
unsigned int size;
void *mem;
};
int rmem_open(void);
void rmem_close(int fd);
void *rmem_alloc(int fd, unsigned long *phy_addr, int size);
void rmem_free(int fd, void *mmaped_rmem, unsigned long phy_addr, int size);
enum rmem_cache_type {
rmem_cache_dev_to_mem,
rmem_cache_mem_to_dev,
};
int rmem_cache_sync(int fd, void *mmaped_mem, int size, enum rmem_cache_type type);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,67 +0,0 @@
#ifndef __LIBHARDWARE2_ROTATOR_H__
#define __LIBHARDWARE2_ROTATOR_H__
#ifdef __cplusplus
extern "C" {
#endif
enum rotator_fmt {
ROTATOR_RGB555,
ROTATOR_ARGB1555,
ROTATOR_RGB565,
ROTATOR_RGB888,
ROTATOR_ARGB8888,//default
ROTATOR_Y8,
ROTATOR_YUV422,
ROTATOR_NV12,
};
enum rotator_convert_order {
ROTATOR_ORDER_RGB_TO_RGB,//default
ROTATOR_ORDER_RBG_TO_RGB,
ROTATOR_ORDER_GRB_TO_RGB,
ROTATOR_ORDER_GBR_TO_RGB,
ROTATOR_ORDER_BRG_TO_RGB,
ROTATOR_ORDER_BGR_TO_RGB,
};
enum rotator_mirror {
ROTATOR_NO_MIRROR,
ROTATOR_MIRROR,
};
enum rotator_angle {
ROTATOR_ANGLE_0,
ROTATOR_ANGLE_90,
ROTATOR_ANGLE_180,
ROTATOR_ANGLE_270,
};
struct rotator_config_data {
void *src_buf;
void *dst_buf;
unsigned int frame_height;
unsigned int frame_width;
unsigned int src_stride;
unsigned int dst_stride;
enum rotator_fmt src_fmt;
enum rotator_convert_order convert_color;
enum rotator_fmt dst_fmt;
enum rotator_mirror horizontal_mirror;
enum rotator_mirror vertical_mirror;
enum rotator_angle rotate_angle;
};
int rotator_open(void);
int rotator_complete_conversion(int handle, struct rotator_config_data *data);
void rotator_close(int handle);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,81 +0,0 @@
#ifndef __LIBHARDWARE2_RSA_H__
#define __LIBHARDWARE2_RSA_H__
#ifdef __cplusplus
extern "C" {
#endif
#define RSA_MAX_KEYL 64
enum rsa_mode {
RSA_1024,
RSA_2048,
};
struct rsa_key {
int is_pub_use;
enum rsa_mode mode;
unsigned int n[RSA_MAX_KEYL];
unsigned int e[RSA_MAX_KEYL];
unsigned int d[RSA_MAX_KEYL];
};
struct rsa_data {
int len;
unsigned int *src;
unsigned int *dst;
};
struct rsa_handle {
int fd;
int keyB;
enum rsa_mode mode;
};
/**
* @brief rsa设备句柄结构体, key密钥文件内的数据解析为rsa数据结构体内的e,d以及n,
* mode, e或d以及n密钥数据写入对应寄存器并等待perprocess完成
* @param key rsa_key结构体, , modee, d, n
* @param key_file , key文件为DER格式
* @return rsa设备句柄结构体, NULL
*/
struct rsa_handle *rsa_open(struct rsa_key *key, char *key_file);
/**
* @brief fd关闭rsa设备
* @param handle rsa设备句柄结构体
* @return
*/
void rsa_close(struct rsa_handle *handle);
/**
* @brief src len个word dst内
* @param fd rsa设备句柄
* @param data rsa数据结构体, src,dst地址,len
* @return 0,
*/
int rsa_crypt(int fd, struct rsa_data *data);
/**
* @brief in文件内容并将结果保存在out内, openssl的PKCS
* @param handle rsa设备句柄结构体, rsa设备句柄fd, mode及长度keyB
* @param in_file
* @param out_file
* @return 0,
*/
int rsa_encrypt_file(struct rsa_handle *handle, char *in_file, char *out_file);
/**
* @brief in文件内容并将结果保存在out内, openssl的PKCS
* @param handle rsa设备句柄结构体, rsa设备句柄fd, mode及长度keyB
* @param in_file
* @param out_file
* @return 0,
*/
int rsa_decrypt_file(struct rsa_handle *handle, char *in_file, char *out_file);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,122 +0,0 @@
#ifndef __LIBHARDWARE2_SPI_H__
#define __LIBHARDWARE2_SPI_H__
#include <linux/spi/spidev.h>
#ifdef __cplusplus
extern "C" {
#endif
struct spi_info {
unsigned char spi_mode;
unsigned int spi_speed;
unsigned char spi_bits;
unsigned char spi_lsb;
};
struct spidev_register_data {
int busnum;
char *cs_gpio;
char spidev_path[20];
};
/**
* @brief spi设备句柄
* @param spi_dev_path spi设备路径,/dev/spidev0.0
* @return ,-1
*/
int spi_open(char *spi_dev_path);
/**
* @brief spi设备
* @param spi_fd spi设备句柄
* @return
*/
void spi_close(int spi_fd);
/**
* @brief spi设备数据传输
* @param spi_fd spi设备句柄
* @param spi_tr spi设备传输需要配置的结构体
* @param num
* @return 0,-1
*/
int spi_transfer(int spi_fd, struct spi_ioc_transfer *spi_tr, int num);
/**
* @brief spi设备数据传输
* @param spi_fd spi设备句柄
* @param tx_buf
* @param len
* @return 0,-1
*/
int spi_write(int spi_fd, char *tx_buf, int len);
/**
* @brief spi设备数据传输
* @param spi_fd spi设备句柄
* @param rx_buf
* @param len
* @return 0,-1
*/
int spi_read(int spi_fd, char *rx_buf, int len);
/**
* @brief spi传输时的模式
* @param spi_fd spi设备句柄
* @param mode
* @return 0,-1
*/
int spi_set_mode(int spi_fd, int mode);
/**
* @brief spi传输时的速度
* @param spi_fd spi设备句柄
* @param speed
* @return 0,-1
*/
int spi_set_speed(int spi_fd, int speed);
/**
* @brief spi传输时的位数
* @param spi_fd spi设备句柄
* @param bits_per_word
* @return 0,-1
*/
int spi_set_bits(int spi_fd, int bits_per_word);
/**
* @brief spi传输时数据的高低位发送顺序
* @param spi_fd spi设备句柄
* @param lsb 10
* @return 0,-1
*/
int spi_set_lsb(int spi_fd, int lsb_first);
/**
* @brief spi传输的配置信息
* @param spi_fd spi设备句柄
* @param spi
* @
*/
void spi_get_info(int spi_fd, struct spi_info *spi);
/**
* @brief spi设备
* @param data spi设备需要准备的结构体
* @return 0 -1
*/
int spi_add_device(struct spidev_register_data *data);
/**
* @brief spi设备
* @param spidev_path ,/dev/spidev0.0
* @return 0,-1
*/
int spi_del_device(char *spidev_path);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,107 +0,0 @@
#ifndef _LIBHARDWARE2_SSLV_H_
#define _LIBHARDWARE2_SSLV_H_
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif
struct sslv_config_data {
unsigned int id; /* SSLV 控制器 ID */
char *name; /* name 仅作为一个标识 */
/* bits_per_word 代表数据的位宽.
:bits_per_word = 32 ,SSLV传输过程中的最小数据单位为32bit. */
unsigned int bits_per_word;
/**
* sslv_pol :
* sslv_pol=0,clk电平为低电平
* sslv_pol=1,clk电平为高电平
* sslv_pha :
* sslv_pha=0沿沿
* sslv_pha=1沿沿
*/
unsigned int sslv_pol;
unsigned int sslv_pha;
unsigned int loop_mode; /* 循环模式 */
};
/**
* @brief SSLV设备句柄
* @param sslv_dev_path sslv设备路径(/dev/sslv0)
* @return sslv设备句柄, -1
*/
int sslv_open(char *sslv_dev_path);
/**
* @brief SSLV设备
* @param fd sslv设备句柄
* @return
*/
void sslv_close(int fd);
/**
* @brief 使SSLV设备
* @param fd sslv设备句柄
* @return 0, -1
*/
int sslv_enable(int fd);
/**
* @brief SSLV设备
* @param fd sslv设备句柄
* @return 0, -1
*/
int sslv_disable(int fd);
/**
* @brief SPI Master发过来的长度为Size的数据
* @param fd sslv设备句柄
* @param buf size长度的数据缓冲区
* @param size (sizeof(buf))
* @return , -1
*/
int sslv_receive(int fd, void *buf, int size);
/**
* @brief SPI Master发送一串长度为Size的数据
* @param fd sslv设备句柄
* @param buf
* @param size
* @param add_zero 0(1 0)
* @return , -1
*/
int sslv_send(int fd, void *buf, int size, char add_zero);
/**
* @brief SSLV注册结构体信息
* @param fd sslv设备句柄
* @param info
* @return
*/
void sslv_get_info(int fd, struct sslv_config_data *info);
/**
* @brief SSLV传输模式
* @param fd sslv设备句柄
* @param mode sslv传输模式(pol | pha)
* @return 0, -1
*/
int sslv_set_mode(int fd, int mode);
/**
* @brief SSLV最小传输单位
* @param fd sslv设备句柄
* @param bits (8/16/32)
* @return 0, -1
*/
int sslv_set_bits(int fd, int bits);
#ifdef __cplusplus
}
#endif
#endif /* _LIBHARDWARE2_SSLV_H_ */

View File

@ -1,118 +0,0 @@
#ifndef V4L2_CAMERA_H_
#define V4L2_CAMERA_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <linux/media.h>
#include <linux/videodev2.h>
#ifndef V4L2_PIX_FMT_SGBRG16
#define V4L2_PIX_FMT_SGBRG16 v4l2_fourcc('G', 'B', '1', '6') /* 16 GBGB.. RGRG.. */
#define V4L2_PIX_FMT_SGRBG16 v4l2_fourcc('G', 'R', '1', '6') /* 16 GRGR.. BGBG.. */
#define V4L2_PIX_FMT_SRGGB16 v4l2_fourcc('R', 'G', '1', '6') /* 16 RGRG.. GBGB.. */
#endif
struct v4l2_camera_format {
int type; // V4L2_BUF_TYPE_VIDEO_CAPTURE,
// V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, ...
unsigned int format; // V4L2_PIX_FMT_YUYV, V4L2_PIX_FMT_MJPEG, ...
int width;
int height;
};
struct v4l2_camera_buffer {
unsigned char *data[8]; // buffer 指针,
// V4L2_PIX_FMT_YUYV -> yuyv: data[0]
// V4L2_PIX_FMT_NV12 -> y: data[0] uv: data[1], ....
int size[8]; // buffer 大小
int index; // buffer index,用户无需关心
};
struct v4l2_camera;
/**
* @brief v4l2
* @param path v4l2 , /dev/video4
* @return v4l2 , NULL
*/
struct v4l2_camera *v4l2_camera_open(const char *path);
/**
* @brief camera
* @param camera v4l2
* @return : 0:
*/
int v4l2_camera_enum_formats(
struct v4l2_camera *camera, struct v4l2_camera_format *fmts, int count);
/**
* @brief camera ,0
* @param camera v4l2
* @param fmt ,0
* @return 0: :
*/
int v4l2_camera_detect_format(
struct v4l2_camera *camera, struct v4l2_camera_format *fmt);
/**
* @brief camera buffer
* @param camera v4l2
* @param fmt
* @param buf_cnt buffer
* @return 0: :
*/
int v4l2_camera_create_buffer(
struct v4l2_camera *camera, struct v4l2_camera_format *fmt, int buf_cnt);
/**
* @brief 使camera ,
* @param camera v4l2
* @return 0: :
*/
int v4l2_camera_stream_on(struct v4l2_camera *camera);
/**
* @brief camera ,
* @param camera v4l2
* @return 0: :
*/
int v4l2_camera_stream_off(struct v4l2_camera *camera);
/**
* @brief buffer
* @param camera v4l2
* @param buf buffer信息
* @param timeout_ms ,,-1
* @return 0: :
*/
int v4l2_camera_dequeue_buffer(
struct v4l2_camera *camera, struct v4l2_camera_buffer *buf, int timeout_ms);
/**
* @brief buffer,
* @param camera v4l2
* @param buf v4l2_camera_dequeue_buffer buffer
* @return 0: :
*/
int v4l2_camera_queue_buffer(
struct v4l2_camera *camera, struct v4l2_camera_buffer *buf);
/**
* @brief v4l2 ,buffer和其他资源
* @param camera v4l2
*/
void v4l2_camera_close(struct v4l2_camera *camera);
/**
* @brief
* @param camera v4l2
*/
void v4l2_camera_dump_format(struct v4l2_camera_format *fmt);
#ifdef __cplusplus
}
#endif
#endif /* V4L2_CAMERA_H_ */

View File

@ -1,40 +0,0 @@
#ifndef _V4L2_H264_DECODE_H_
#define _V4L2_H264_DECODE_H_
#ifdef __cplusplus
extern "C" {
#endif
struct v4l2_h264_decoder_config {
const char *video_path;
unsigned int width;
unsigned int height;
unsigned int output_fmt;
/*
* v4l2_h264_decoder_open
* x2600 felix 128 480 512
* output_mem[i]
*/
unsigned int linesize;
};
struct v4l2_h264_decoder;
struct v4l2_h264_decoder *v4l2_h264_decoder_open(struct v4l2_h264_decoder_config *config);
/**
* H264解码输出为nv12void *out_mem[2]out_mem[0]y数据out_mem[1]uv数据
**/
int v4l2_h264_decoder_work(struct v4l2_h264_decoder *decoder, void *input_mem,
unsigned int input_size, void **output_mem);
int v4l2_h264_decoder_work_release(struct v4l2_h264_decoder *decoder);
int v4l2_h264_decoder_close(struct v4l2_h264_decoder *decoder);
#ifdef __cplusplus
}
#endif
#endif /* _V4L2_H264_DECODE_H_ */

View File

@ -1,65 +0,0 @@
#ifndef _V4L2_H264_ENCODE_H_
#define _V4L2_H264_ENCODE_H_
#include <stdbool.h>
#include <linux/videodev2.h>
#include <linux/v4l2-controls.h>
#ifdef __cplusplus
extern "C" {
#endif
struct v4l2_h264_encoder_config {
const char *video_path;
unsigned int width;
unsigned int height;
unsigned int line_length;
unsigned int input_fmt;
unsigned int gop_size;
unsigned int bitrate;
};
struct v4l2_h264_encoder;
struct v4l2_h264_encoder *v4l2_h264_encoder_open(struct v4l2_h264_encoder_config *config);
void *v4l2_h264_encoder_work(struct v4l2_h264_encoder *encoder, void *input_mem,
unsigned int *ouput_size);
/**
* input_mem需要物理上连续使v4l2_h264_encoder_work一致
**/
void *v4l2_h264_encoder_work_phys(struct v4l2_h264_encoder *encoder,
void *input_mem, unsigned int *ouput_size);
void *v4l2_h264_encoder_work_separate(struct v4l2_h264_encoder *encoder,
void *y_mem, void *uv_mem, unsigned int *ouput_size);
/**
* y_mem和uv_mem分别需要物理上连续使v4l2_h264_encoder_work_separate一致
**/
void *v4l2_h264_encoder_work_phys_separate(struct v4l2_h264_encoder *encoder,
void *y_mem, void *uv_mem, unsigned int *ouput_size);
/**
* v4l2_h264_encoder_work :
* 使inputmem的内存作为VPU输入源,.(mem必须是物理上连续的)
* */
void *v4l2_h264_encoder_work_by_phy_mem(struct v4l2_h264_encoder *encoder,
void *input_mem, unsigned long phy_mem, unsigned int *ouput_size);
/*获取最新编出来的是否为关键帧 0p/b 帧 1 i帧*/
int v4l2_h264_encoder_get_whether_keyframe(struct v4l2_h264_encoder *encoder);
int v4l2_h264_encoder_close(struct v4l2_h264_encoder *encoder);
void v4l2_h264_encoder_set_keyframe(struct v4l2_h264_encoder *encoder);
int v4l2_h264_encoder_get_stream_param(struct v4l2_h264_encoder *encoder, struct v4l2_streamparm *param);
#ifdef __cplusplus
}
#endif
#endif /* _V4L2_H264_ENCODE_H_ */

View File

@ -1,31 +0,0 @@
#ifndef _V4L2_JPEG_DECODE_H_
#define _V4L2_JPEG_DECODE_H_
#ifdef __cplusplus
extern "C" {
#endif
struct v4l2_jpeg_decoder_config {
const char *video_path;
unsigned int width;
unsigned int height;
unsigned int output_fmt; // 参考 <linux/videodev2.h> -> V4L2_PIX_FMT_NV12( v4l2_fourcc('N', 'V', '1', '2') )
};
struct v4l2_jpeg_decoder;
struct v4l2_jpeg_decoder *v4l2_jpeg_decoder_open(struct v4l2_jpeg_decoder_config *config);
/**
* JPEG解码输出为nv12void *out_mem[2]out_mem[0]y数据out_mem[1]uv数据
**/
int v4l2_jpeg_decoder_work(struct v4l2_jpeg_decoder *decoder, void *input_mem, unsigned int input_size, void **output_mem);
int v4l2_jpeg_decoder_close(struct v4l2_jpeg_decoder *decoder);
#ifdef __cplusplus
}
#endif
#endif /* _V4L2_JPEG_DECODE_H_ */

View File

@ -1,33 +0,0 @@
#ifndef _V4L2_JPEG_ENCODE_H_
#define _V4L2_JPEG_ENCODE_H_
#include <stdbool.h>
#include <linux/videodev2.h>
#ifdef __cplusplus
extern "C" {
#endif
struct v4l2_jpeg_encoder_config {
const char *video_path;
unsigned int width;
unsigned int height;
unsigned int line_length;
unsigned int input_fmt;
unsigned int quality;
};
struct v4l2_jpeg_encoder;
struct v4l2_jpeg_encoder *v4l2_jpeg_encoder_open(struct v4l2_jpeg_encoder_config *config);
void *v4l2_jpeg_encoder_work(struct v4l2_jpeg_encoder *encoder, void *input_mem,
unsigned int *ouput_size);
int v4l2_jpeg_encoder_close(struct v4l2_jpeg_encoder *encoder);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,40 +0,0 @@
#ifndef __LIBHARDWARE2_WATCHDOG_H__
#define __LIBHARDWARE2_WATCHDOG_H__
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief
* @param ms ms
* @return 0
*/
int watchdog_start(unsigned long ms);
/**
* @brief
* @param NULL
* @return 0
*/
int watchdog_stop(void);
/**
* @brief
* @param NULL
* @return 0
*/
int watchdog_feed(void);
/**
* @brief cpu复位重启
* @param NULL
* @return 0
*/
int watchdog_reset(void);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,184 +0,0 @@
#ifndef __LIBHARDWARE2_WIFI_H__
#define __LIBHARDWARE2_WIFI_H__
#include <pthread.h>
#ifdef __cplusplus
extern "C" {
#endif
/* WIFI网络状态信息结构体 */
struct wifi_network_status_info {
/* WIFI连接的热点的 MAC 地址 */
char bssid[64];
/* WIFI 频率 单位MHz*/
int freq;
/* WIFI名称 */
char ssid[256];
/* 网络的id号 */
int network_id;
/* WIFI 模式(station模式、 ap模式) */
char mode[32];
/* WIFI 加密套件(AES-CCMP、TKIP、WEP40、WEP104、WEP128) */
char group_cipher[32];
/* WIFI 加密模式 (WPA2-PSK 、WPA2-PSK、 WPA2、WPA、不加密) */
char cipher_mode[32];
/* WIFI 状态
* INACTIVE WIFI管理器已经关闭
* SCANNING
* ASSOCIATING WIFI设备正在连接中
* ASSOCIATED WIFI设备连接成功
* FOUR_WAY_HANDSHAKE WPA 4-Way Key握手过程中
* GROUP_HANDSHAKE WPA Group Key握手过程中
* COMPLETED
* DISCONNECTED WIFI设备不能连接热点
*/
char status[64];
/* WIFI 被分配的IP地址 */
char ip_addr[32];
/* WIFI网卡MAC地址 */
char mac_addr[64];
/* 通用唯一识别码 */
char uuid[64];
/* WIFI 信号强度(0~100) 单位dB */
int signal_strength;
};
/* wifi网络扫描热点信息结构体 */
struct wifi_network_scan_info {
/* WIFI连接的热点的 MAC 地址 */
char bssid[64];
/* WIFI 频率 单位MHz */
int freq;
/* WIFI 信号强度(0~100) 单位dB */
int signal_strength;
/* WIFI热点加密模式(WIFI 模式 + WIFI 加密套件 的组合) */
char cipher_mode[128];
/* WIFI名称 */
char ssid[256];
};
/* 网络状态 */
enum wifi_connect_state {
/* 网络正在连接 */
WIFI_CONNECTING,
/* 网络连接成功 */
WIFI_CONNECTED,
/* 网络断开连接 */
WIFI_DISCONNECTED,
};
enum wifi_server_state {
/* 服务端处于打开状态 */
SERVER_CONNECT,
/* 服务端处于关闭状态 */
SERVER_DISCONNECT,
};
/* wifi 网络事件回调 */
typedef struct wifi_event_callback {
/* 连接网络不存在回调 */
void (*network_not_found_cb)();
/* 连接网络密钥错误回调 */
void (*network_wrong_key_cb)();
/* 服务端状态发生改变回调 */
void (*network_server_changed_cb)(enum wifi_server_state state);
/* 网络状态发生改变回调 */
void (*network_state_changed_cb)(enum wifi_connect_state state);
/* 此callback_state变量为回调状态,用户无需设置,内部实现使用 */
volatile unsigned int callback_state;
pthread_t tid;
} wifi_event_callback;
/*
* @brief
* @param callback
*/
void wifi_register_event_callback(struct wifi_event_callback *callback);
/*
* @brief
* @param callback
*/
void wifi_unregister_event_callback(struct wifi_event_callback *callback);
/*
* @brief wifi服务端
* @param network_config_path wifi服务端配置路径
*/
void wifi_start_network_server(const char *network_config_path);
/*
* @brief wifi服务端
*/
void wifi_stop_network_server(void);
/*
* @brief wifi服务端状态
* @return 1,0
*/
enum wifi_server_state wifi_check_network_server_state(void);
/*
* @brief
* @param network_ssid wifi名称
* @param network_psk wifi密码,NULL
* @param network_bssid mac地址NULL(ssid和psk都相同时可以由bssid指定连接哪个热点)
* @return ,
*/
int wifi_connect_network(const char *network_ssid, const char *network_psk, const char *network_bssid);
/**
* @brief wifi状态
* @return ,
*/
int wifi_disconnect_current_network(void);
/**
* @brief wifi
* @param network_info wifi信息
* @param info_count wifi信息结构体的数量
* @return wifi数量,
*/
int wifi_get_scan_info(struct wifi_network_scan_info* network_info, int info_count);
/**
* @brief wifi状态
* @param neiwork_info wifi状态信息
* @return ,
*/
int wifi_get_status_info(struct wifi_network_status_info* neiwork_info);
/*
* @brief
* @param network_config_path wifi配置保存的路径
* @param network_ssid wifi名称
* @param network_psk wifi密码NULL
* @param network_bssid wifi连接热点的mac地址,NULL
* @return 0,
*/
int wifi_save_network_config(const char *network_config_path, const char *network_ssid, const char *network_psk, const char *network_bssid);
#ifdef __cplusplus
}
#endif
#endif /* __LIBHARDWARE2_WIFI_H__ */

View File

@ -1,109 +0,0 @@
include .config.in
#
# 定义默认目标
#
all: all_targets
#
# 编译选项
#
CFLAGS = -Os -fPIC -Wall -Werror -Wno-error=stringop-overflow -Wno-error=address -Wno-error=builtin-declaration-mismatch
CFLAGS += -Iinclude/
CFLAGS += -include config.h
CFLAGS += -Wno-pointer-sign
CFLAGS += -Wno-pointer-to-int-cast
obj_dir = .objs/
NO_DMA_COHERENT=0
ENABLE_ARM_L2_CACHE=0
USE_VDK=0
EGL_API_FB=0
STATIC_LINK=0
ABI=0
DEBUG=0
CUSTOM_PIXMAP=0
ANDROID=0
EGL_API_ANDROID=0
USE_3D_VG=0
CONFIG_DOVEXC5_BOARD=0
DIRECTFB_MAJOR_VERSION=1
DIRECTFB_MINOR_VERSION=0
DIRECTFB_MICRO_VERSION=0
include makefile.linux.def
CFLAGS += -Isrc/lib/user -Isrc/lib/os -Isrc/lib/hardware -Isrc/lib/include/
# ----------------------
# 编译 lib2d.so
# ----------------------
module_name = output/lib2d.so
src-$(APP_lib2d) += src/lib/os/gc_hal_user_debug.c
src-$(APP_lib2d) += src/lib/os/gc_hal_user_math.c
src-$(APP_lib2d) += src/lib/os/gc_hal_user_os.c
src-$(APP_lib2d) += src/lib/user/gc_hal_user_brush.c
src-$(APP_lib2d) += src/lib/user/gc_hal_user_brush_cache.c
src-$(APP_lib2d) += src/lib/user/gc_hal_user_dump.c
src-$(APP_lib2d) += src/lib/user/gc_hal_user.c
src-$(APP_lib2d) += src/lib/user/gc_hal_user_raster.c
src-$(APP_lib2d) += src/lib/user/gc_hal_user_heap.c
src-$(APP_lib2d) += src/lib/user/gc_hal_user_query.c
src-$(APP_lib2d) += src/lib/user/gc_hal_user_rect.c
src-$(APP_lib2d) += src/lib/user/gc_hal_user_buffer.c
src-$(APP_lib2d) += src/lib/user/gc_hal_user_surface.c
src-$(APP_lib2d) += src/lib/user/gc_hal_user_queue.c
src-$(APP_lib2d) += src/lib/hardware/gc_hal_user_hardware_blt.c
src-$(APP_lib2d) += src/lib/hardware/gc_hal_user_hardware_clear.c
src-$(APP_lib2d) += src/lib/hardware/gc_hal_user_hardware_context.c
src-$(APP_lib2d) += src/lib/hardware/gc_hal_user_hardware_filter_blt_de.c
src-$(APP_lib2d) += src/lib/hardware/gc_hal_user_hardware_filter_blt_vr.c
src-$(APP_lib2d) += src/lib/hardware/gc_hal_user_hardware.c
src-$(APP_lib2d) += src/lib/hardware/gc_hal_user_hardware_pattern.c
src-$(APP_lib2d) += src/lib/hardware/gc_hal_user_hardware_pipe.c
src-$(APP_lib2d) += src/lib/hardware/gc_hal_user_hardware_primitive.c
src-$(APP_lib2d) += src/lib/hardware/gc_hal_user_hardware_query.c
src-$(APP_lib2d) += src/lib/hardware/gc_hal_user_hardware_source.c
src-$(APP_lib2d) += src/lib/hardware/gc_hal_user_hardware_target.c
src-$(APP_lib2d) += src/lib/ingenic2d.c
include tools/build_elf.mk
# ---------------------------
# the end
# ---------------------------
all_targets: $(module_targets)
@echo " compiled $(all_modules)"
libs = $(filter %.so,$(all_modules))
ifneq ($(libs),)
define install_libs
$(Q)cp -f $(libs) $(FS_TARGET_DIR)/usr/lib/
$(Q)cp -f $(libs) $(FS_STAGING_DIR)/usr/lib/
@echo " installed $(libs) include/lib2d/"
endef
define clean_install_libs
$(Q)rm -f $(addprefix $(FS_TARGET_DIR)/usr/lib/, $(notdir $(libs)))
$(Q)rm -f $(addprefix $(FS_STAGING_DIR)/usr/lib/, $(notdir $(libs)))
@echo " removed $(libs) include/lib2d/"
endef
endif
install:
$(install_libs)
clean_install:
$(clean_install_libs)
clean:
$(Q)rm -rf output/
$(Q)rm -rf $(module_clean_files)
.PHONY: all clean all_targets clean_install install

View File

@ -1,79 +0,0 @@
#
# 定义默认目标
#
include .config.in
all: all_targets
#
# 编译选项
#
CFLAGS = -Os
CFLAGS += -Iinclude/
CFLAGS += -include config.h -Wall -Werror
CFLAGS += -Wno-pointer-sign
CFLAGS += -Wno-pointer-to-int-cast
LDFLAGS = -Loutput/ -lhardware2 -lpthread -l2d
obj_dir = .objs/
check_lib = $(shell tools/check_lib.sh $(CROSS_COMPILE)gcc $1)
module_name = output/ingenic_2d_scale
src-$(APP_ingenic2d_cmd) += src/cmd/main_scale.c
include tools/build_elf.mk
module_name = output/ingenic_2d_rotater
src-$(APP_ingenic2d_cmd) += src/cmd/main_rotater.c
include tools/build_elf.mk
module_name = output/ingenic_2d_fill_rect
src-$(APP_ingenic2d_cmd) += src/cmd/main_fill_rect.c
include tools/build_elf.mk
module_name = output/ingenic_2d_blend
src-$(APP_ingenic2d_cmd) += src/cmd/main_blend.c
include tools/build_elf.mk
module_name = output/ingenic_2d_convert
src-$(APP_ingenic2d_cmd) += src/cmd/main_convert.c
include tools/build_elf.mk
module_name = output/ingenic_2d_draw_lines
src-$(APP_ingenic2d_cmd) += src/cmd/main_draw_lines.c
include tools/build_elf.mk
module_name = output/ingenic_2d_filp
src-$(APP_ingenic2d_cmd) += src/cmd/main_filp.c
include tools/build_elf.mk
# ---------------------------
# the end
# ---------------------------
all_targets: $(module_targets)
@echo " compiled $(all_modules)"
cmds = $(filter-out %.so,$(all_modules))
ifneq ($(cmds),)
define install_cmds
$(Q)cp -f $(cmds) $(FS_TARGET_DIR)/usr/bin/
@echo " installed $(cmds)"
endef
define clean_install_cmds
$(Q)rm -f $(addprefix $(FS_TARGET_DIR)/usr/bin/, $(notdir $(cmds)))
@echo " removed $(cmds)"
endef
endif
install:
$(install_cmds)
clean_install:
$(clean_install_cmds)
clean:
$(Q)rm -rf output/
$(Q)rm -rf $(module_clean_files)
.PHONY: all clean all_targets clean_install install

View File

@ -1,40 +0,0 @@
# 检查 .config.in include/config.h 是否有更新
make_sure_config_update:=$(shell tools/check_config.sh $(config_in) 2> /dev/null)
export V
export Q
export CROSS_COMPILE
export FS_TARGET_DIR
export FS_STAGING_DIR
# make V=1 可以看见Makefile运转的细节
ifneq ($(V),1)
Q = @
MAKE_ARG = --no-print-directory
else
Q =
MAKE_ARG =
endif
all:
$(Q)+make $(MAKE_ARG) -f lib2d.mk all
$(Q)+make $(MAKE_ARG) -f lib2d_cmd.mk all
clean:
$(Q)+make $(MAKE_ARG) -f lib2d.mk clean
$(Q)+make $(MAKE_ARG) -f lib2d_cmd.mk clean
clean_install:
$(if $(FS_TARGET_DIR),,$(error must set FS_TARGET_DIR))
$(if $(FS_STAGING_DIR),,$(error must set FS_STAGING_DIR))
$(Q)+make $(MAKE_ARG) -f lib2d.mk clean_install
$(Q)+make $(MAKE_ARG) -f lib2d_cmd.mk clean_install
install:
$(if $(FS_TARGET_DIR),,$(error must set FS_TARGET_DIR))
$(if $(FS_STAGING_DIR),,$(error must set FS_STAGING_DIR))
$(Q)+make $(MAKE_ARG) -f lib2d.mk install
$(Q)+make $(MAKE_ARG) -f lib2d_cmd.mk install
.PHONY: all clean install

View File

@ -1,337 +0,0 @@
##############################################################################
#
# Copyright (C) 2005 - 2010 by Vivante Corp.
#
# 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., 675 Mass Ave, Cambridge, MA 02139, USA.
#
##############################################################################
#
# Common inlude file for Linux build.
#
################################################################
# Arch.
#ARCH_TYPE ?= arm
CPU_TYPE ?= 0
CPU_ARCH ?= 0
STATIC_LINK ?= 0
EGL_API_FB ?= 0
USE_VDK ?= 0
USE_PROFILER ?= 0
USE_SW_FB ?= 0
USE_3D_VG ?= 1
ABI ?= 0
ANDROID ?= 0
EGL_API_ANDROID ?= 0
ENUM_WORKAROUND ?= 0
ENDIANNESS ?=
QNX ?= 0
LINUX_OABI ?= 0
USE_ARMCC ?= 0
ifeq ($(LINUX_OABI), 1)
ABI ?= 0
else
ABI ?= aapcs-linux
endif
################################################################
# Toolchain.
ifeq ($(USE_ARMCC),1)
ARM_BASE ?= /home/software/ARM
ARM_VERSION ?= 4.0/650
CROSS_COMPILE ?= $(ARM_BASE)/RVCT/Programs/$(ARM_VERSION)/linux-pentium/arm
CFLAGS += -I$(ARM_BASE)/RVCT/Data/$(ARM_VERSION)/include/unix
CC := $(CROSS_COMPILE)cc
CXX := $(CROSS_COMPILE)cc
AR := $(CROSS_COMPILE)ar
AS := $(CROSS_COMPILE)as
LD := $(CROSS_COMPILE)link
else
CROSS_COMPILE ?= arm-none-linux-gnueabi-
CC := $(CROSS_COMPILE)gcc
CXX := $(CROSS_COMPILE)g++
AR := $(CROSS_COMPILE)ar
AS := $(CROSS_COMPILE)as
LD := $(CROSS_COMPILE)ld
RANLIB := $(CROSS_COMPILE)ranlib
STRIP := $(CROSS_COMPILE)strip
endif
################################################################
# Make command.
MAKE = make --makefile=makefile.linux
DRV_MAKE ?= make --makefile=Kbuild
################################################################
# Resource.
TOOL_DIR ?= /home/software/Linux
ANDROID_HOME ?=
KERNEL_DIR ?= $(TOOL_DIR)/kernel
X11_ARM_DIR ?= $(TOOL_DIR)/X11_ARM
################################################################
# Target directory.
ifeq ($(DEBUG), 1)
OBJ_DIR ?= bin_d
else
OBJ_DIR ?= bin_r
endif
################################################################
# Force to use the new compiler.
SC2X_NEW ?= 1
ES11_NEW ?= 1
################################################################
# Release directory.
SDK_DIR ?= $(AQROOT)/build/sdk
VIVANTE_SDK_DIR ?= $(AQROOT)/sdk
VIVANTE_SDK_INC ?= $(VIVANTE_SDK_DIR)/include
VIVANTE_SDK_LIB ?= $(VIVANTE_SDK_DIR)/drivers
################################################################
# Force to use dma_coherent_* stuff.
NO_DMA_COHERENT ?= 0
################################################################
# Set this value to 1 if you are using ARM L2 cache.
ENABLE_ARM_L2_CACHE = 0
################################################################
# Set this value to 1 if you are using DOVE board.
CONFIG_DOVE_GPU = 0
###############################################################
# Common CFLAGS.
ifeq ($(USE_ARMCC), 1)
CFLAGS += --c99 #--strict
else
ifeq ($(ABI), 0)
else
CFLAGS += -mabi=$(ABI)
endif
ifneq ($(ENDIANNESS),)
CFLAGS += $(ENDIANNESS)
LFLAGS += $(ENDIANNESS)
PFLAGS += $(ENDIANNESS)
endif
endif
ifeq ($(ANDROID), 1)
USE_VDK = 0
ifeq ($(ARCH_TYPE), arm)
CFLAGS += -I$(ANDROID_HOME)/bionic/libstdc++/include -I$(ANDROID_HOME)/bionic/libc/arch-arm/include -I$(ANDROID_HOME)/bionic/libc/include -I$(ANDROID_HOME)/bionic/libc/kernel/common/ -I$(ANDROID_HOME)/bionic/libc/kernel/arch-arm -I$(ANDROID_HOME)/bionic/libm/include -I$(ANDROID_HOME)/bionic/libm/include/arch/arm -I$(ANDROID_HOME)/bionic/libthread_db/include
CFLAGS += -DANDROID -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -fno-short-enums
endif
ifeq ($(ARCH_TYPE), xburst)
CFLAGS += -I$(ANDROID_HOME)/bionic/libstdc++/include -I$(ANDROID_HOME)/bionic/libc/arch-xburst/include -I$(ANDROID_HOME)/bionic/libc/include -I$(ANDROID_HOME)/bionic/libc/kernel/common/ -I$(ANDROID_HOME)/bionic/libc/kernel/arch-xburst -I$(ANDROID_HOME)/bionic/libm/include -I$(ANDROID_HOME)/bionic/libm/include/mips -I$(ANDROID_HOME)/bionic/libthread_db/include
endif
ifeq ($(EGL_API_ANDROID), 1)
CFLAGS += -DEGL_API_ANDROID
endif
ifeq ($(ANDROID_VERSION_ECLAIR), 1)
CFLAGS += -DANDROID_VERSION_ECLAIR
endif
endif
ifeq ($(QNX), 1)
CFLAGS += -D__QNXNTO__
else
ifneq ($(USE_ARMCC),1)
CFLAGS += -DLINUX
endif
endif
ifeq ($(LINUX_OABI), 1)
CFLAGS += -DLINUX_OABI
endif
ifneq ($(USE_ARMCC), 1)
CFLAGS += -Wall -D_REENTRANT -fno-strict-aliasing
ifeq ($(CPU_TYPE), 0)
else
CFLAGS += -mcpu=$(CPU_TYPE)
AFLAGS += -mcpu=$(CPU_TYPE)
endif
ifeq ($(CPU_ARCH), 0)
else
CFLAGS += -march=$(CPU_ARCH)
AFLAGS += -march=$(CPU_ARCH)
endif
endif
ifeq ($(DEBUG), 1)
CFLAGS += -O2 -DDEBUG -D_DEBUG -DgcdDEBUG=1
else
CFLAGS += -O2
endif
ifeq ($(EGL_API_FB), 1)
CFLAGS += -DEGL_API_FB
endif
ifeq ($(STATIC_LINK), 1)
CFLAGS += -DSTATIC_LINK
endif
ifeq ($(USE_VDK), 1)
CFLAGS += -DUSE_VDK=1 -DUSE_SW_FB=$(USE_SW_FB)
else
CFLAGS += -DUSE_VDK=0
endif
ifeq ($(USE_NEW_LINUX_SIGNAL), 1)
CFLAGS += -DUSE_NEW_LINUX_SIGNAL=1
endif
ifneq ($(USE_ARMCC), 1)
CXXFLAGS += -fno-short-enums
endif
ifneq (,$(EGL_APPENDIX))
CFLAGS += -D_EGL_APPENDIX=$(EGL_APPENDIX)
endif
ifneq (,$(GL_11_APPENDIX))
CFLAGS += -D_GL_11_APPENDIX=$(GL_11_APPENDIX)
endif
ifneq (,$(GL_2_APPENDIX))
CFLAGS += -D_GL_2_APPENDIX=$(GL_2_APPENDIX)
endif
ifneq (,$(VG_APPENDIX))
CFLAGS += -D_VG_APPENDIX=$(VG_APPENDIX)
endif
CFLAGS += -DgcdREGISTER_ACCESS_FROM_USER=1
################################################################################
# Build with profiler
ifeq ($(USE_PROFILER),1)
CFLAGS += -DVIVANTE_PROFILER=1
endif
################################################################
# Module directories.
# drivers
GAL_DIR := $(AQROOT)/hal
ifeq ($(ES11_NEW), 1)
GLES11_DIR := $(AQROOT)/driver/openGL/libGLESv11
else
GLES11_DIR := $(AQROOT)/driver/openGL/es11/driver
endif
EGL_DIR := $(AQROOT)/driver/openGL/egl
GLES2X_DIR := $(AQROOT)/driver/openGL/libGLESv2x
ifeq ($(USE_3D_VG), 1)
VG11_DIR := $(AQROOT)/driver/openVG/vg11
OVG11_DIR := $(AQROOT)/driver/openVG/vg11/driver
else
VG11_DIR := $(AQROOT)/driver/openGL/libOpenVG
OVG11_DIR := $(AQROOT)/driver/openGL/libOpenVG
endif
GFX_DIR := $(AQROOT)/driver/gfx
ifeq ($(SC2X_NEW), 1)
SC2X_LIB_DIR := $(GLES2X_DIR)/compiler/libGLESv2SC/entry
else
SC2X_LIB_DIR := $(GLES2X_DIR)/slc/glslang/MachineIndependent/compiler
endif
VIVANTE_LIB_DIR := $(AQROOT)/sdk/vivante
# applications
EGL_TEST_DIR := $(AQROOT)/test/egl
ES11_TEST_DIR := $(AQROOT)/test/es11/Linux
ES2X_TEST_DIR := $(AQROOT)/test/es20
ES2X_EXTERN_DIR := $(AQROOT)/test/es20/extern
ES20_TEST_DIR := $(AQROOT)/sdk/samples/es20
ifeq ($(USE_VDK), 0)
TUTORIAL_DIR := $(ES11_TEST_DIR)
endif
VDK_TEST_DIR := $(AQROOT)/sdk/samples/vdk
HAL_TEST_DIR := $(AQROOT)/sdk
HAL_CUSTOM_DIR := $(AQROOT)/test/hal/Linux/custom
CHIPINFO_DIR := $(AQROOT)/test/hal/common/chipinfo
VDK_DIR := $(AQROOT)/sdk/vdk
ifeq ($(USE_VDK), 1)
CONFORM_DIR := $(AQROOT)/test/es11/conform
else
# old es11 conformce test was removed
# $(AQROOT)/driver/openGL/es11/test/conform
CONFORM_DIR :=
endif
GLBES11_DIR := $(AQROOT)/test/es11/GLBenchmark_ES1.1v2
GLBES20_DIR := $(AQROOT)/test/es20/GLBenchmark2_RC2
GLBESNAVI11_DIR := $(AQROOT)/test/es11/GLBenchmark_Navi_Beta2/es11
GLBESNAVI20_DIR := $(AQROOT)/test/es11/GLBenchmark_Navi_Beta2/es20
GTF_DIR := $(AQROOT)/test/es20/conform/GTF_ES/glsl/GTF
VGMARK_DIR := $(AQROOT)/test/vg/common/VGMark_10_src
VGMARK11_DIR := $(AQROOT)/test/vg11/VGMark11/VGMark11_addendum
VGCTS_DIR := $(AQROOT)/test/vg/ovg_1.0.1_cts_rc10
VGCTS11_DIR := $(AQROOT)/test/vg/ovg_1.1_cts_rc10
ifeq ($(USE_VDK), 1)
MM06_DIR := $(AQROOT)/test/es11/common/3DMarkMobile06/configuration/vdk
else
MM06_DIR := $(ES11_TEST_DIR)/3DMarkMobile06
endif
MM07_DIR := $(ES2X_TEST_DIR)/3DMarkMobileES2_RC_src
MM07U_DIR := $(ES2X_TEST_DIR)/3DMarkMobileES2_Update
SM20_DIR := $(AQROOT)/test/es20/SimulationMark_ES_2.0
KANZI_DIR := $(AQROOT)/test/es20/Kanzi_UI_demo/Kanzi_UI_src
AB20_DIR := $(ES2X_TEST_DIR)/Automotive
JRC_DIR := $(ES2X_TEST_DIR)/JRC
GFX_TEST_DIR := $(AQROOT)/test/gfx
ES20_GEARS_DIR := $(AQROOT)/test/es20/gles2-cm-gears
ES11_UNIT_DIR := $(AQROOT)/test/es11/common/UnitTest
ES11_EXTERN_DIR := $(AQROOT)/test/es11/extern
ES11_EXTENSION_DIR := $(AQROOT)/test/es11/Extension
ES11_GEARS_DIR := $(AQROOT)/test/es11/gles1-cm-gears
VG11_UNIT_DIR := $(AQROOT)/test/vg11/UnitTest
VG11_EXTERN_DIR := $(AQROOT)/test/vg11/extern
# third party resources
DFB_DIR ?= $(TOOL_DIR)/dfb
TEXTURE5_DIR := $(ES2X_TEST_DIR)/texture5
TEXTURE7_DIR := $(ES2X_TEST_DIR)/texture7
ACTINIUM_DIR := $(ES2X_TEST_DIR)/actinium
VVLAUNCHER_DIR := $(ES2X_TEST_DIR)/vv_launcher
VIDEOCUBE_DIR := $(AQROOT)/test/es11/extern/VideoCube

View File

@ -1,88 +0,0 @@
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <lib2d/ingenic2d.h>
#include <libhardware2/fb.h>
#define SRC_GLOBAL_ALPHA 0xff
#define SRC_WIDTH 1280
#define SRC_HEIGHT 720
#define DST_WIDTH 1920
#define DST_HEIGHT 1080
#define src_file_path "/usr/data/src_1280_720.rgb"
#define dst_file_path "/usr/data/dst_1920_1080.rgb"
#include "utils.c"
static int fb_fd;
static struct fb_device_info fb_info;
int main(void)
{
int ret;
FILE *srcfile = fopen(src_file_path, "rb");
if (!srcfile) {
fprintf(stderr, "failed to open src faile\n");
return -1;
}
FILE *dstfile = fopen(dst_file_path, "rb");
if (!dstfile) {
fprintf(stderr, "failed to open dst_file\n");
fclose(srcfile);
return -1;
}
fb_fd = fb_open("/dev/fb0", &fb_info);
if (fb_fd < 0) {
fprintf(stderr, "failed to open fb\n");
return -1;
}
fb_enable(fb_fd);
struct ingenic_2d *ingenic_2d = ingenic_2d_open();
if (!ingenic_2d)
return -1;
struct ingenic_2d_frame *src_frame = ingenic_2d_alloc_frame(ingenic_2d, SRC_WIDTH, SRC_HEIGHT, INGENIC_2D_ARGB8888);
if (!src_frame)
return -1;
struct ingenic_2d_frame *dst_frame = ingenic_2d_alloc_frame(ingenic_2d, DST_WIDTH, DST_HEIGHT, INGENIC_2D_ARGB8888);
if (!dst_frame)
return -1;
read_raw(srcfile, src_frame->addr[0], src_frame->align_height, SRC_WIDTH * 4, src_frame->stride);
read_raw(dstfile, dst_frame->addr[0], dst_frame->align_height, DST_WIDTH * 4, dst_frame->stride);
struct ingenic_2d_rect src_rect = ingenic_2d_rect_init(src_frame, 0, 0, SRC_WIDTH, SRC_HEIGHT);
struct ingenic_2d_rect dst_rect = ingenic_2d_rect_init(dst_frame, (DST_WIDTH - SRC_WIDTH) / 2,
(DST_HEIGHT - SRC_HEIGHT) / 2, SRC_WIDTH, SRC_HEIGHT);
ret = ingenic_2d_blend(ingenic_2d, &src_rect, &dst_rect, SRC_GLOBAL_ALPHA);
if (ret < 0)
return -1;
fb_display(fb_fd, &fb_info, dst_rect.frame);
file_write_data("/usr/data/output.raw", dst_frame->addr[0], dst_frame->stride * dst_frame->align_height);
ingenic_2d_free_frame(ingenic_2d, src_frame);
ingenic_2d_free_frame(ingenic_2d, dst_frame);
ingenic_2d_close(ingenic_2d);
fb_close(fb_fd, &fb_info);
return 0;
}

View File

@ -1,77 +0,0 @@
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <lib2d/ingenic2d.h>
#include <libhardware2/fb.h>
#define SRC_WIDTH 1080
#define SRC_HEIGHT 1920
#define DST_WIDTH 1080
#define DST_HEIGHT 1920
#define FILE_PATH "/usr/data/1080_1920_yuyv422.yuv"
#include "utils.c"
static int fb_fd;
static struct fb_device_info fb_info;
int main(void)
{
int ret;
FILE *infile = fopen(FILE_PATH, "rb");
if (!infile) {
fprintf(stderr, "failed to open faile %s\n", FILE_PATH);
return -1;
}
fb_fd = fb_open("/dev/fb0", &fb_info);
if (fb_fd < 0) {
fprintf(stderr, "failed to open fb\n");
return -1;
}
fb_enable(fb_fd);
struct ingenic_2d *ingenic_2d = ingenic_2d_open();
if (!ingenic_2d)
return -1;
struct ingenic_2d_frame *src_frame = ingenic_2d_alloc_frame(ingenic_2d, SRC_WIDTH, SRC_HEIGHT, INGENIC_2D_YUYV422);
if (!src_frame)
return -1;
struct ingenic_2d_frame *dst_frame = ingenic_2d_alloc_frame(ingenic_2d, DST_WIDTH, DST_HEIGHT, INGENIC_2D_ARGB8888);
if (!dst_frame)
return -1;
read_raw(infile, src_frame->addr[0], SRC_HEIGHT, SRC_WIDTH * 2, src_frame->stride);
struct ingenic_2d_rect src_rect = ingenic_2d_rect_init(src_frame, -1, -1, -1, -1);
struct ingenic_2d_rect dst_rect = ingenic_2d_rect_init(dst_frame, -1, -1, -1, -1);
ret = ingenic_2d_convert(ingenic_2d, &src_rect, &dst_rect);
if(ret < 0)
return -1;
fb_display(fb_fd, &fb_info, dst_rect.frame);
file_write_data("/usr/data/output.raw", dst_frame->addr[0], dst_frame->stride * dst_frame->align_height);
ingenic_2d_free_frame(ingenic_2d, src_frame);
ingenic_2d_free_frame(ingenic_2d, dst_frame);
ingenic_2d_close(ingenic_2d);
fb_close(fb_fd, &fb_info);
return 0;
}

View File

@ -1,99 +0,0 @@
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <lib2d/ingenic2d.h>
#include <libhardware2/fb.h>
#define DST_WIDTH 1920
#define DST_HEIGHT 1080
#define LINE_COLOR 0xff578845
#include "utils.c"
static int fb_fd;
static struct fb_device_info fb_info;
int main(void)
{
int ret;
fb_fd = fb_open("/dev/fb0", &fb_info);
if (fb_fd < 0) {
fprintf(stderr, "failed to open fb\n");
return -1;
}
fb_enable(fb_fd);
struct ingenic_2d *ingenic_2d = ingenic_2d_open();
if (!ingenic_2d)
return -1;
struct ingenic_2d_frame *dst_frame = ingenic_2d_alloc_frame(ingenic_2d, DST_WIDTH, DST_HEIGHT, INGENIC_2D_ARGB8888);
if (!dst_frame)
return -1;
struct ingenic_2d_line lines[8];
lines[0].x0 = 0;
lines[0].y0 = 0;
lines[0].x1 = dst_frame->width;
lines[0].y1 = dst_frame->height;
lines[1].x0 = dst_frame->width;
lines[1].y0 = 0;
lines[1].x1 = 0;
lines[1].y1 = dst_frame->height;
lines[2].x0 = 0;
lines[2].y0 = dst_frame->height/2;
lines[2].x1 = dst_frame->width;
lines[2].y1 = dst_frame->height/2;
lines[3].x0 = dst_frame->width/2;
lines[3].y0 = 0;
lines[3].x1 = dst_frame->width/2;
lines[3].y1 = dst_frame->height;
lines[4].x0 = dst_frame->width/4;
lines[4].y0 = 0;
lines[4].x1 = dst_frame->width/4;
lines[4].y1 = dst_frame->height;
lines[5].x0 = dst_frame->width*3/4;
lines[5].y0 = 0;
lines[5].x1 = dst_frame->width*3/4;
lines[5].y1 = dst_frame->height;
lines[6].x0 = 0;
lines[6].y0 = dst_frame->height/4;
lines[6].x1 = dst_frame->width;
lines[6].y1 = dst_frame->height/4;
lines[7].x0 = 0;
lines[7].y0 = dst_frame->height*3/4;
lines[7].x1 = dst_frame->width;
lines[7].y1 = dst_frame->height*3/4;
struct ingenic_2d_rect dst_rect = ingenic_2d_rect_init(dst_frame, -1, -1, -1, -1);
ret = ingenic_2d_draw_lines(ingenic_2d, &dst_rect, lines, 8, LINE_COLOR);
if (ret < 0)
return -1;
fb_display(fb_fd, &fb_info,dst_rect.frame);
file_write_data("/usr/data/output.raw", dst_frame->addr[0], dst_frame->stride * dst_frame->align_height);
ingenic_2d_free_frame(ingenic_2d, dst_frame);
ingenic_2d_close(ingenic_2d);
fb_close(fb_fd, &fb_info);
return 0;
}

View File

@ -1,65 +0,0 @@
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <lib2d/ingenic2d.h>
#include <libhardware2/fb.h>
#define DST_WIDTH 1920
#define DST_HEIGHT 1080
#define DRAW_X 0
#define DRAW_Y 0
#define DRAW_WIDTH 1280
#define DRAW_HEIGHT 720
#define DRAW_COLOR 0xff00ff00
#include "utils.c"
static int fb_fd;
static struct fb_device_info fb_info;
int main(void)
{
int ret;
fb_fd = fb_open("/dev/fb0", &fb_info);
if (fb_fd < 0) {
fprintf(stderr, "failed to open fb\n");
return -1;
}
fb_enable(fb_fd);
struct ingenic_2d *ingenic_2d = ingenic_2d_open();
if (!ingenic_2d)
return -1;
struct ingenic_2d_frame *dst_frame = ingenic_2d_alloc_frame(ingenic_2d, DST_WIDTH, DST_HEIGHT, INGENIC_2D_ARGB8888);
if (!dst_frame)
return -1;
struct ingenic_2d_rect dst_rect = ingenic_2d_rect_init(dst_frame, DRAW_X,
DRAW_Y, DRAW_WIDTH, DRAW_HEIGHT);
ret = ingenic_2d_fill_rect(ingenic_2d, &dst_rect, DRAW_COLOR);
if (ret < 0)
return -1;
fb_display(fb_fd, &fb_info, dst_rect.frame);
file_write_data("/usr/data/output.raw", dst_frame->addr[0], dst_frame->stride * dst_frame->align_height);
ingenic_2d_free_frame(ingenic_2d, dst_frame);
ingenic_2d_close(ingenic_2d);
fb_close(fb_fd, &fb_info);
return 0;
}

View File

@ -1,76 +0,0 @@
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <lib2d/ingenic2d.h>
#include <libhardware2/fb.h>
#define SRC_WIDTH 1080
#define SRC_HEIGHT 1920
#define DST_WIDTH 1080
#define DST_HEIGHT 1920
#define FILE_PATH "/usr/data/1080_1920_rgb.yuv"
#include "utils.c"
static int fb_fd;
static struct fb_device_info fb_info;
int main(void)
{
int ret;
FILE *infile = fopen(FILE_PATH, "rb");
if (!infile) {
fprintf(stderr, "failed to open faile %s\n", FILE_PATH);
return -1;
}
fb_fd = fb_open("/dev/fb0", &fb_info);
if (fb_fd < 0) {
fprintf(stderr, "failed to open fb\n");
return -1;
}
fb_enable(fb_fd);
struct ingenic_2d *ingenic_2d = ingenic_2d_open();
if (!ingenic_2d)
return -1;
struct ingenic_2d_frame *src_frame = ingenic_2d_alloc_frame(ingenic_2d, SRC_WIDTH, SRC_HEIGHT, INGENIC_2D_ARGB8888);
if (!src_frame)
return -1;
struct ingenic_2d_frame *dst_frame = ingenic_2d_alloc_frame(ingenic_2d, DST_WIDTH, DST_HEIGHT, INGENIC_2D_ARGB8888);
if (!dst_frame)
return -1;
read_raw(infile, src_frame->addr[0], SRC_HEIGHT, SRC_WIDTH * 4, src_frame->stride);
struct ingenic_2d_rect src_rect = ingenic_2d_rect_init(src_frame, -1, -1, -1, -1);
struct ingenic_2d_rect dst_rect = ingenic_2d_rect_init(dst_frame, -1, -1, -1, -1);
ret = ingenic_2d_filp(ingenic_2d, &src_rect, &dst_rect, 1, 1);
if (ret < 0)
return -1;
fb_display(fb_fd, &fb_info,dst_rect.frame);
file_write_data("/usr/data/output.raw", dst_frame->addr[0], dst_frame->stride * dst_frame->align_height);
ingenic_2d_free_frame(ingenic_2d, src_frame);
ingenic_2d_free_frame(ingenic_2d, dst_frame);
ingenic_2d_close(ingenic_2d);
fb_close(fb_fd, &fb_info);
return 0;
}

View File

@ -1,85 +0,0 @@
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <lib2d/ingenic2d.h>
#include <libhardware2/fb.h>
#define SRC_WIDTH 500
#define SRC_HEIGHT 500
#define DST_WIDTH 500
#define DST_HEIGHT 500
#define SRC_RECT_WIDTH 500
#define SRC_RECT_HEIGHT 500
#define DST_RECT_WIDTH 500
#define DST_RECT_HEIGHT 500
#define FILE_PATH "/usr/data/500_500_bgra.yuv"
#include "utils.c"
static int fb_fd;
static struct fb_device_info fb_info;
int main(void)
{
int ret;
FILE *infile = fopen(FILE_PATH, "rb");
if (!infile) {
fprintf(stderr, "failed to open faile %s\n", FILE_PATH);
return -1;
}
fb_fd = fb_open("/dev/fb0", &fb_info);
if (fb_fd < 0) {
fprintf(stderr, "failed to open fb\n");
return -1;
}
fb_enable(fb_fd);
struct ingenic_2d *ingenic_2d = ingenic_2d_open();
if (!ingenic_2d)
return -1;
struct ingenic_2d_frame *src_frame = ingenic_2d_alloc_frame(ingenic_2d, SRC_WIDTH, SRC_HEIGHT, INGENIC_2D_ARGB8888);
if (!src_frame)
return -1;
struct ingenic_2d_frame *dst_frame = ingenic_2d_alloc_frame(ingenic_2d, DST_WIDTH, DST_HEIGHT, INGENIC_2D_ARGB8888);
if (!dst_frame)
return -1;
read_raw(infile, src_frame->addr[0], SRC_HEIGHT, SRC_WIDTH * 4, src_frame->stride);
struct ingenic_2d_rect src_rect = ingenic_2d_rect_init(src_frame, (SRC_WIDTH - SRC_RECT_WIDTH) / 2,
(SRC_HEIGHT - SRC_RECT_HEIGHT) / 2, SRC_RECT_WIDTH, SRC_RECT_HEIGHT);
struct ingenic_2d_rect dst_rect = ingenic_2d_rect_init(dst_frame, (DST_WIDTH - DST_RECT_WIDTH) / 2,
(DST_HEIGHT - DST_RECT_HEIGHT) / 2, DST_RECT_WIDTH, DST_RECT_HEIGHT);
ret = ingenic_2d_rotate(ingenic_2d, ROTATE_90, &src_rect, &dst_rect);
if (ret < 0)
return -1;
fb_display(fb_fd, &fb_info,dst_rect.frame);
file_write_data("/usr/data/output.raw", dst_frame->addr[0], dst_frame->stride * dst_frame->align_height);
ingenic_2d_free_frame(ingenic_2d, src_frame);
ingenic_2d_free_frame(ingenic_2d, dst_frame);
ingenic_2d_close(ingenic_2d);
fb_close(fb_fd, &fb_info);
return 0;
}

View File

@ -1,84 +0,0 @@
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <libhardware2/fb.h>
#include <lib2d/ingenic2d.h>
#define SRC_WIDTH 1080
#define SRC_HEIGHT 1920
#define DST_WIDTH 1080
#define DST_HEIGHT 1920
#define SRC_RECT_WIDTH 800
#define SRC_RECT_HEIGHT 480
#define DST_RECT_WIDTH 720
#define DST_RECT_HEIGHT 1280
#define FILE_PATH "/usr/data/1080_1920_rgb.yuv"
#include "utils.c"
static int fb_fd;
static struct fb_device_info fb_info;
int main(void)
{
int ret;
FILE *infile = fopen(FILE_PATH, "rb");
if (!infile) {
fprintf(stderr, "failed to open faile %s\n", FILE_PATH);
return -1;
}
fb_fd = fb_open("/dev/fb0", &fb_info);
if (fb_fd < 0) {
fprintf(stderr, "failed to open fb\n");
return -1;
}
fb_enable(fb_fd);
struct ingenic_2d *ingenic_2d = ingenic_2d_open();
if (!ingenic_2d)
return -1;
struct ingenic_2d_frame *src_frame = ingenic_2d_alloc_frame(ingenic_2d, SRC_WIDTH, SRC_HEIGHT, INGENIC_2D_ARGB8888);
if (!src_frame)
return -1;
struct ingenic_2d_frame *dst_frame = ingenic_2d_alloc_frame(ingenic_2d, DST_WIDTH, DST_HEIGHT, INGENIC_2D_ARGB8888);
if (!dst_frame)
return -1;
read_raw(infile, src_frame->addr[0], SRC_HEIGHT, SRC_WIDTH * 4, src_frame->stride);
struct ingenic_2d_rect src_rect = ingenic_2d_rect_init(src_frame, (SRC_WIDTH - SRC_RECT_WIDTH) / 2,
(SRC_HEIGHT - SRC_RECT_HEIGHT) / 2, SRC_RECT_WIDTH, SRC_RECT_HEIGHT);
struct ingenic_2d_rect dst_rect = ingenic_2d_rect_init(dst_frame, 0,
0, DST_RECT_WIDTH, DST_RECT_HEIGHT);
ret = ingenic_2d_scale(ingenic_2d, &src_rect, &dst_rect);
if (ret < 0)
return -1;
fb_display(fb_fd, &fb_info,dst_rect.frame);
file_write_data("/usr/data/output.raw", dst_frame->addr[0], dst_frame->stride * dst_frame->align_height);
ingenic_2d_free_frame(ingenic_2d, src_frame);
ingenic_2d_free_frame(ingenic_2d, dst_frame);
ingenic_2d_close(ingenic_2d);
fb_close(fb_fd, &fb_info);
return 0;
}

View File

@ -1,87 +0,0 @@
int read_raw(FILE *fp, void *src, int height, int src_stride, int dst_stride)
{
size_t read_size = 0;
int i = 0;
for (i = 0; i < height; i++) {
read_size = fread(src, sizeof(char), src_stride, fp);
if(read_size != src_stride) {
fprintf(stderr, "mscaler: fread y fail, read_size(%d) != default_stride(%d)\n", read_size, src_stride);
return -1;
}
src += dst_stride;
}
return 0;
}
int file_write_data(const char *out_file, void *data, unsigned long data_size)
{
int ret = 0;
FILE *file = fopen(out_file, "w");
if (!file) {
fprintf(stderr, "file_utils: failed to open file: %s (%s)\n",
out_file, strerror(errno));
return -1;
}
int N = 1024*1024;
while (data_size) {
int size = data_size < N ? data_size : N;
ret = fwrite(data, 1, size, file);
if (ret < 0) {
fprintf(stderr, "file_utils: failed to write file: %s (%s) %d\n",
out_file, strerror(errno), size);
goto close_file;
}
data_size -= ret;
data += ret;
}
ret = 0;
fflush(file);
close_file:
fclose(file);
return ret;
}
void fb_display(int fb_fd, struct fb_device_info *info, struct ingenic_2d_frame *frame)
{
struct lcdc_layer layer_cfg = {
.xres = DST_WIDTH,
.yres = DST_HEIGHT,
.xpos = 0,
.ypos = 0,
.fb_fmt = fb_fmt_ARGB8888,
.layer_order = lcdc_layer_0,
.layer_enable = 1,
.rgb = {
.mem = (void *)frame->phyaddr[0],
.stride = frame->stride,
},
.alpha = {
.enable = 0,
},
.scaling = {
.enable = 1,
.xres = info->xres,
.yres = info->yres,
},
};
fb_pan_display_enable_user_cfg(fb_fd);
fb_pan_display_set_user_cfg(fb_fd, &layer_cfg);
fb_pan_display(fb_fd, info, 0);
}

View File

@ -1,259 +0,0 @@
/****************************************************************************
*
* Copyright (c) 2005 - 2010 by Vivante Corp. All rights reserved.
*
* The material in this file is confidential and contains trade secrets
* of Vivante Corporation. This is proprietary information owned by
* Vivante Corporation. No part of this work may be disclosed,
* reproduced, copied, transmitted, or used in any way for any purpose,
* without the express written permission of Vivante Corporation.
*
*****************************************************************************
*
* Auto-generated file on 11/10/2010. Do not edit!!!
*
*****************************************************************************/
#ifndef __gc_hal_user_hardware_h_
#define __gc_hal_user_hardware_h_
#ifdef __cplusplus
extern "C" {
#endif
/******************************************************************************\
********************************** Structures **********************************
\******************************************************************************/
/* FilterBlt information. */
typedef struct _gcsFILTER_BLIT_ARRAY
{
gceFILTER_TYPE filterType;
gctUINT8 kernelSize;
gctUINT32 scaleFactor;
gctUINT16_PTR kernelArray;
gctBOOL kernelChanged;
}
gcsFILTER_BLIT_ARRAY;
typedef gcsFILTER_BLIT_ARRAY * gcsFILTER_BLIT_ARRAY_PTR;
typedef enum
{
gcvVAA_NONE,
gcvVAA_COVERAGE_16,
gcvVAA_COVERAGE_8,
}
gceVAA;
/* gcoHARDWARE object. */
struct _gcoHARDWARE
{
/* Object. */
gcsOBJECT object;
/* Pointer to the gcoHAL object. */
gcoHAL hal;
/* Pointer to the gcoOS object. */
gcoOS os;
/* Command buffer. */
gcoBUFFER buffer;
/* Context buffer. */
gcoCONTEXT context;
/* Event queue. */
gcoQUEUE queue;
/* Chip characteristics. */
gceCHIPMODEL chipModel;
gctUINT32 chipRevision;
gctUINT32 chipFeatures;
gctUINT32 chipMinorFeatures;
gctUINT32 chipMinorFeatures1;
gctUINT32 streamCount;
gctUINT32 registerMax;
gctUINT32 threadCount;
gctUINT32 shaderCoreCount;
gctUINT32 vertexCacheSize;
gctUINT32 vertexOutputBufferSize;
gctINT needStriping;
/* Big endian */
gctBOOL bigEndian;
/* API type. */
gceAPI api;
/* Temporary buffer parameters. */
struct _gcsSURF_INFO tempBuffer;
/* Filter blit. */
gceFILTER_TYPE loadedFilterType;
gctUINT8 loadedKernelSize;
gctUINT32 loadedScaleFactor;
gceFILTER_TYPE newFilterType;
gctUINT8 newHorKernelSize;
gctUINT8 newVerKernelSize;
gctBOOL horUserFilterPass;
gctBOOL verUserFilterPass;
gcsFILTER_BLIT_ARRAY horSyncFilterKernel;
gcsFILTER_BLIT_ARRAY verSyncFilterKernel;
gcsFILTER_BLIT_ARRAY horBlurFilterKernel;
gcsFILTER_BLIT_ARRAY verBlurFilterKernel;
gcsFILTER_BLIT_ARRAY horUserFilterKernel;
gcsFILTER_BLIT_ARRAY verUserFilterKernel;
/* Depth mode. */
gceDEPTH_MODE depthMode;
gctBOOL depthOnly;
/* Maximum depth value. */
gctUINT32 maxDepth;
gctBOOL earlyDepth;
/* Stencil mask. */
gctBOOL stencilEnabled;
gctUINT32 stencilMode;
gctBOOL stencilKeepFront[3];
gctBOOL stencilKeepBack[3];
/* Texture sampler modes. */
gctUINT32 samplerMode[16];
gctUINT32 samplerLOD[12];
/* Stall before rendingering triangles. */
gctBOOL stallPrimitive;
/* Tile status information. */
gctUINT32 memoryConfig;
gctBOOL paused;
gctBOOL cacheDirty;
gctBOOL targetDirty;
gcsSURF_INFO_PTR currentTarget;
gcsSURF_INFO_PTR currentDepth;
gctBOOL inFlush;
gctUINT32 physicalTileColor;
gctUINT32 physicalTileDepth;
/* Anti-alias mode. */
gctUINT32 sampleMask;
gctUINT32 sampleEnable;
gcsSAMPLES samples;
gceVAA vaa;
struct
{
gctUINT8 x;
gctUINT8 y;
} sampleCoords[4][4];
gctUINT8 jitterIndex[4][4];
/* Dither. */
gctUINT32 dither[2];
/* For bandwidth optimization. */
gctBOOL alphaBlendEnable;
gctUINT8 colorWrite;
gctBOOL colorCompression;
gctUINT32 destinationRead;
/* Stall signal. */
gctSIGNAL stallSignal;
/***************************************************************************
** 2D states.
*/
/* 2D hardware availability flag. */
gctBOOL hw2DEngine;
/* Software 2D force flag. */
gctBOOL sw2DEngine;
/* 2D hardware Pixel Engine 2.0 availability flag. */
gctBOOL hw2DPE20;
/* Byte write capability. */
gctBOOL byteWrite;
/* BitBlit rotation capability. */
gctBOOL fullBitBlitRotation;
/* FilterBlit rotation capability. */
gctBOOL fullFilterBlitRotation;
/* Need to shadow RotAngleReg? */
gctBOOL shadowRotAngleReg;
/* The shadow value. */
gctUINT32 rotAngleRegShadow;
/* Pattern states. */
gcoBRUSH_CACHE brushCache;
/* Temporary pattern table used for color convert. */
gctUINT32_PTR patternTable;
gctBOOL patternTableProgram;
gctUINT patternTableIndexCount;
gctUINT patternTableFirstIndex;
/* Mono colors needed for backward compatibility. */
gctUINT32 fgColor;
gctUINT32 bgColor;
gctBOOL monoColorProgram;
/* Global colors needed for backward compatibility. */
gctUINT32 globalSrcColor;
gctUINT32 globalTargetColor;
/* Transparency states. */
gctUINT32 srcTransparency;
gctUINT32 dstTransparency;
gctUINT32 patTransparency;
gctUINT32 transparencyColor;
gctBOOL transparencyColorProgram;
/* Src configuration state. */
gctUINT32 srcConfig;
/* 2D clipping rectangle. */
gcsRECT clippingRect;
/* Source rectangle. */
gcsRECT sourceRect;
/* Surface information. */
struct _gcsSURF_INFO sourceSurface;
struct _gcsSURF_INFO targetSurface;
/* Temp surface for fast clear */
gcoSURF tempSurface;
};
gceSTATUS
gcoHARDWARE_OptimizeBandwidth(
IN gcoHARDWARE Hardware
);
gceSTATUS
gcoHARDWARE_FlushL2Cache(
IN gcoHARDWARE Hardware
);
#ifdef __cplusplus
}
#endif
#endif /* __gc_hal_user_hardware_h_ */

View File

@ -1,93 +0,0 @@
/****************************************************************************
*
* Copyright (c) 2005 - 2010 by Vivante Corp. All rights reserved.
*
* The material in this file is confidential and contains trade secrets
* of Vivante Corporation. This is proprietary information owned by
* Vivante Corporation. No part of this work may be disclosed,
* reproduced, copied, transmitted, or used in any way for any purpose,
* without the express written permission of Vivante Corporation.
*
*****************************************************************************
*
* Auto-generated file on 11/10/2010. Do not edit!!!
*
*****************************************************************************/
#include "gc_hal_user_hardware_precomp.h"
/* Zone used for header/footer. */
#define _GC_OBJ_ZONE gcvZONE_HARDWARE
/*******************************************************************************
**
** gcoHARDWARE_CopyData
**
** Copy linear data from user memory to video memory.
**
** INPUT:
**
** gcoHARDWARE Hardware
** Pointer to an gcoHARDWARE object.
**
** gcsSURF_NODE_PTR Memory
** Pointer to the gcsSURF_NODE structure that defines the video memory
** to copy the user data into.
**
** gctUINT32 Offset
** Offset into video memory to start copying data into.
**
** gctCONST_POINTER Buffer
** Pointer to user data to copy.
**
** gctSIZE_T Bytes
** Number of byte to copy.
**
** OUTPUT:
**
** Nothing
*/
gceSTATUS
gcoHARDWARE_CopyData(
IN gcoHARDWARE Hardware,
IN gcsSURF_NODE_PTR Memory,
IN gctUINT32 Offset,
IN gctCONST_POINTER Buffer,
IN gctSIZE_T Bytes
)
{
gceSTATUS status;
gcmHEADER_ARG("Hardware=%d Memory=0x%x Offset=%u Buffer=0x%x Bytes=%d",
Hardware, Memory, Offset, Buffer, Bytes);
/* Verify the arguments. */
gcmVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE);
gcmVERIFY_ARGUMENT(Memory != gcvNULL);
gcmVERIFY_ARGUMENT(Buffer != gcvNULL);
gcmVERIFY_ARGUMENT(Bytes > 0);
do
{
/* Verify that the surface is locked. */
gcmVERIFY_NODE_LOCK(Memory);
/* Copy the memory using the CPU. */
gcmERR_BREAK(gcoOS_MemCopy(Memory->logical + Offset, Buffer, Bytes));
/* Flush the CPU cache. */
gcmERR_BREAK(gcoOS_CacheFlush(Hardware->os,
Memory->logical + Offset,
Bytes));
}
while (gcvFALSE);
/* Return result. */
gcmFOOTER();
return status;
}

View File

@ -1,862 +0,0 @@
/****************************************************************************
*
* Copyright (c) 2005 - 2010 by Vivante Corp. All rights reserved.
*
* The material in this file is confidential and contains trade secrets
* of Vivante Corporation. This is proprietary information owned by
* Vivante Corporation. No part of this work may be disclosed,
* reproduced, copied, transmitted, or used in any way for any purpose,
* without the express written permission of Vivante Corporation.
*
*****************************************************************************
*
* Auto-generated file on 11/10/2010. Do not edit!!!
*
*****************************************************************************/
#include "gc_hal_user_hardware_precomp.h"
/* Zone used for header/footer. */
#define _GC_OBJ_ZONE gcvZONE_HARDWARE
/******************************************************************************\
****************************** gcoHARDWARE API Code *****************************
\******************************************************************************/
/*******************************************************************************
**
** gcoHARDWARE_ClearRect
**
** Append a command buffer with a CLEAR command.
**
** INPUT:
**
** gcoHARDWARE Hardware
** Pointer to an gcoHARDWARE object.
**
** gctUINT32 Address
** Base address of surface to clear.
**
** gctPOINTER Memory
** Base address of surface to clear.
**
** gctUINT32 Stride
** Stride of surface.
**
** gctINT32 Left
** Left coordinate of rectangle to clear.
**
** gctINT32 Top
** Top coordinate of rectangle to clear.
**
** gctINT32 Right
** Right coordinate of rectangle to clear.
**
** gctINT32 Bottom
** Bottom coordinate of rectangle to clear.
**
** gceSURF_FORMAT Format
** Format of surface to clear.
**
** gctUINT32 ClearValue
** Value to be used for clearing the surface.
**
** gctUINT8 ClearMask
** Byte-mask to be used for clearing the surface.
**
** OUTPUT:
**
** Nothing.
*/
gceSTATUS
gcoHARDWARE_ClearRect(
IN gcoHARDWARE Hardware,
IN gctUINT32 Address,
IN gctPOINTER Memory,
IN gctUINT32 Stride,
IN gctINT32 Left,
IN gctINT32 Top,
IN gctINT32 Right,
IN gctINT32 Bottom,
IN gceSURF_FORMAT Format,
IN gctUINT32 ClearValue,
IN gctUINT8 ClearMask
)
{
gceSTATUS status;
gcmHEADER_ARG("Hardware=0x%x Address=%x Memory=0x%x "
"Stride=%d Left=%d Top=%d "
"Right=%d Bottom=%d Format=%d "
"ClearValue=%d ClearMask=%d",
Hardware, Address, Memory,
Stride, Left, Top,
Right, Bottom, Format,
ClearValue, ClearMask);
/* Verify the arguments. */
gcmVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE);
/* Try hardware clear. */
status = gcoHARDWARE_Clear(Hardware,
Address,
Stride,
Left,
Top,
Right,
Bottom,
Format,
ClearValue,
ClearMask);
if (gcmIS_ERROR(status))
{
/* Use software clear. */
status = gcoHARDWARE_ClearSoftware(Hardware,
Memory,
Stride,
Left,
Top,
Right,
Bottom,
Format,
ClearValue,
ClearMask);
}
/* Return the staus. */
gcmFOOTER();
return status;
}
/*******************************************************************************
**
** gcoHARDWARE_Clear
**
** Append a command buffer with a CLEAR command.
**
** INPUT:
**
** gcoHARDWARE Hardware
** Pointer to an gcoHARDWARE object.
**
** gctUINT32 Address
** Base address of surface to clear.
**
** gctUINT32 Stride
** Stride of surface.
**
** gctINT32 Left
** Left coordinate of rectangle to clear.
**
** gctINT32 Top
** Top coordinate of rectangle to clear.
**
** gctINT32 Right
** Right coordinate of rectangle to clear.
**
** gctINT32 Bottom
** Bottom coordinate of rectangle to clear.
**
** gceSURF_FORMAT Format
** Format of surface to clear.
**
** gctUINT32 ClearValue
** Value to be used for clearing the surface.
**
** gctUINT8 ClearMask
** Byte-mask to be used for clearing the surface.
**
** OUTPUT:
**
** Nothing.
*/
gceSTATUS
gcoHARDWARE_Clear(
IN gcoHARDWARE Hardware,
IN gctUINT32 Address,
IN gctUINT32 Stride,
IN gctINT32 Left,
IN gctINT32 Top,
IN gctINT32 Right,
IN gctINT32 Bottom,
IN gceSURF_FORMAT Format,
IN gctUINT32 ClearValue,
IN gctUINT8 ClearMask
)
{
gceSTATUS status;
gctUINT32 format, swizzle, isYUVformat;
gceTILING tiling;
gctINT32 tileWidth, tileHeight;
gctUINT32 leftMask, topMask, widthMask, heightMask;
gctUINT32 stride;
gcmHEADER_ARG("Hardware=0x%x Address=%x Stride=%d "
"Left=%d Top=%d Right=%d Bottom=%d "
"Format=%d ClearValue=%d ClearMask=%d",
Hardware, Address, Stride,
Left, Top, Right, Bottom,
Format, ClearValue, ClearMask);
/* Verify the arguments. */
gcmVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE);
switch (Format)
{
case gcvSURF_X4R4G4B4:
case gcvSURF_X1R5G5B5:
case gcvSURF_R5G6B5:
case gcvSURF_X4B4G4R4:
case gcvSURF_X1B5G5R5:
if (ClearMask == 0x7)
{
/* When the format has no alpha channel, fake the ClearMask to
** include alpha channel clearing. This will allow us to use
** resolve clear. */
ClearMask = 0xF;
}
break;
default:
break;
}
if ((ClearMask != 0xF)
&& (Format != gcvSURF_X8R8G8B8)
&& (Format != gcvSURF_A8R8G8B8)
&& (Format != gcvSURF_D24S8)
&& (Format != gcvSURF_D24X8)
)
{
/* Don't clear with mask when channels are not byte sized. */
gcmFOOTER_ARG("status=%d", gcvSTATUS_NOT_SUPPORTED);
return gcvSTATUS_NOT_SUPPORTED;
}
/* Supertiled destination? */
if ((Stride & 0x80000000U) != 0)
{
/* Set the tiling mode. */
tiling = gcvSUPERTILED;
/* Set the tile size. */
tileWidth = 64;
tileHeight = 64;
}
/* Not supertiled. */
else
{
/* Set the tiling mode. */
tiling = gcvTILED;
/* Query the tile size. */
status = gcoHARDWARE_QueryTileSize(gcvNULL, gcvNULL,
&tileWidth, &tileHeight,
gcvNULL);
if (gcmIS_ERROR(status))
{
/* Error. */
gcmFOOTER();
return status;
}
}
/* All sides must be tile aligned. */
leftMask = tileWidth - 1;
topMask = tileHeight - 1;
/* The size has to be 4x1 tile aligned. */
widthMask = 4 * 4 - 1;
heightMask = 4 * 1 - 1;
/* Convert the format. */
status = gcoHARDWARE_TranslateDestinationFormat(Hardware,
Format,
&format,
&swizzle,
&isYUVformat);
if (status != gcvSTATUS_OK)
{
/* Error. */
gcmFOOTER();
return status;
}
/* For resolve clear, we need to be 4x1 tile aligned. */
if ((( Left & leftMask) == 0)
&& (( Top & topMask) == 0)
&& (((Right - Left) & widthMask) == 0)
&& (((Bottom - Top) & heightMask) == 0)
)
{
gctUINT32 config, control, size;
gctUINT32 dither[2] = { ~0U, ~0U };
gctUINT32 offset, address, bitsPerPixel;
/* Set up the starting address of clear rectangle. */
gcmVERIFY_OK(
gcoHARDWARE_ConvertFormat(Hardware,
Format,
&bitsPerPixel,
gcvNULL));
/* Compute the origin offset. */
gcmVERIFY_OK(
gcoHARDWARE_ComputeOffset(Left, Top,
Stride,
bitsPerPixel / 8,
tiling, &offset));
/* Determine the starting address. */
address = Address + offset;
/* Build AQRsConfig register. */
config = ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 4:0) - (0 ? 4:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 4:0) - (0 ? 4:0) + 1))))))) << (0 ? 4:0))) | (((gctUINT32) ((gctUINT32) (format) & ((gctUINT32) ((((1 ? 4:0) - (0 ? 4:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 4:0) - (0 ? 4:0) + 1))))))) << (0 ? 4:0)))
| ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 12:8) - (0 ? 12:8) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 12:8) - (0 ? 12:8) + 1))))))) << (0 ? 12:8))) | (((gctUINT32) ((gctUINT32) (format) & ((gctUINT32) ((((1 ? 12:8) - (0 ? 12:8) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 12:8) - (0 ? 12:8) + 1))))))) << (0 ? 12:8)))
| ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 14:14) - (0 ? 14:14) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 14:14) - (0 ? 14:14) + 1))))))) << (0 ? 14:14))) | (((gctUINT32) ((gctUINT32) (gcvTRUE) & ((gctUINT32) ((((1 ? 14:14) - (0 ? 14:14) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 14:14) - (0 ? 14:14) + 1))))))) << (0 ? 14:14)));
/* Build AQRsClearControl register. */
control = ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 15:0) - (0 ? 15:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 15:0) - (0 ? 15:0) + 1))))))) << (0 ? 15:0))) | (((gctUINT32) ((gctUINT32) (ClearMask) & ((gctUINT32) ((((1 ? 15:0) - (0 ? 15:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 15:0) - (0 ? 15:0) + 1))))))) << (0 ? 15:0)))
| ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 17:16) - (0 ? 17:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 17:16) - (0 ? 17:16) + 1))))))) << (0 ? 17:16))) | (((gctUINT32) ((gctUINT32) (gcvTRUE) & ((gctUINT32) ((((1 ? 17:16) - (0 ? 17:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 17:16) - (0 ? 17:16) + 1))))))) << (0 ? 17:16)));
/* Build AQRsWindowSize register. */
size = ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 15:0) - (0 ? 15:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 15:0) - (0 ? 15:0) + 1))))))) << (0 ? 15:0))) | (((gctUINT32) ((gctUINT32) (Right-Left) & ((gctUINT32) ((((1 ? 15:0) - (0 ? 15:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 15:0) - (0 ? 15:0) + 1))))))) << (0 ? 15:0)))
| ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 31:16) - (0 ? 31:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:16) - (0 ? 31:16) + 1))))))) << (0 ? 31:16))) | (((gctUINT32) ((gctUINT32) (Bottom-Top) & ((gctUINT32) ((((1 ? 31:16) - (0 ? 31:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:16) - (0 ? 31:16) + 1))))))) << (0 ? 31:16)));
/* Determine the stride. */
stride = ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 17:0) - (0 ? 17:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 17:0) - (0 ? 17:0) + 1))))))) << (0 ? 17:0))) | (((gctUINT32) ((gctUINT32) (Stride<<2) & ((gctUINT32) ((((1 ? 17:0) - (0 ? 17:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 17:0) - (0 ? 17:0) + 1))))))) << (0 ? 17:0)))
| ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 31:31) - (0 ? 31:31) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:31) - (0 ? 31:31) + 1))))))) << (0 ? 31:31))) | (((gctUINT32) ((gctUINT32) ((Stride>>31)) & ((gctUINT32) ((((1 ? 31:31) - (0 ? 31:31) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:31) - (0 ? 31:31) + 1))))))) << (0 ? 31:31)))
;
do
{
/* Switch to 3D pipe. */
gcmERR_BREAK(
gcoHARDWARE_SelectPipe(Hardware, 0x0));
/* Flush cache. */
gcmERR_BREAK(gcoHARDWARE_FlushPipe(Hardware));
/* Program registers. */
gcmERR_BREAK(gcoHARDWARE_LoadState32(Hardware,
0x01604,
config));
gcmERR_BREAK(gcoHARDWARE_LoadState(Hardware,
0x01630,
2, dither));
gcmERR_BREAK(gcoHARDWARE_LoadState32(Hardware,
0x01610,
address));
gcmERR_BREAK(gcoHARDWARE_LoadState32(Hardware,
0x01614,
stride));
gcmERR_BREAK(gcoHARDWARE_LoadState32(Hardware,
0x01620,
size));
gcmERR_BREAK(gcoHARDWARE_LoadState32(Hardware,
0x01640,
ClearValue));
gcmERR_BREAK(gcoHARDWARE_LoadState32(Hardware,
0x0163C,
control));
/* Append new configuration register. */
gcmERR_BREAK(
gcoHARDWARE_LoadState32(Hardware,
0x016A0,
((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 1:0) - (0 ? 1:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 1:0) - (0 ? 1:0) + 1))))))) << (0 ? 1:0))) | (((gctUINT32) (0x0 & ((gctUINT32) ((((1 ? 1:0) - (0 ? 1:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 1:0) - (0 ? 1:0) + 1))))))) << (0 ? 1:0)))));
gcmERR_BREAK(gcoHARDWARE_LoadState32(Hardware,
0x01600,
0xBEEBBEEB));
if (( (Format == gcvSURF_D16)
|| (Format == gcvSURF_D24S8)
|| (Format == gcvSURF_D24X8)
)
&& Hardware->earlyDepth
)
{
/* Make raster wait for clear to be done. */
gcmERR_BREAK(gcoHARDWARE_Semaphore(Hardware,
gcvWHERE_RASTER,
gcvWHERE_PIXEL,
gcvHOW_SEMAPHORE));
}
}
while (gcvFALSE);
/* Target has dirty pixels. */
Hardware->targetDirty = gcvTRUE;
/* Return the status. */
gcmFOOTER();
return status;
}
/* Removed 2D clear as it does not work for tiled buffers. */
/* Error. */
gcmFOOTER_ARG("status=%d", gcvSTATUS_NOT_SUPPORTED);
return gcvSTATUS_NOT_SUPPORTED;
}
/*******************************************************************************
**
** gcoHARDWARE_ClearSoftware
**
** Clear the buffer with software implementation. Buffer is assumed to be
** tiled.
**
** INPUT:
**
** gcoHARDWARE Hardware
** Pointer to an gcoHARDWARE object.
**
** gctPOINTER LogicalAddress
** Base address of surface to clear.
**
** gctUINT32 Stride
** Stride of surface.
**
** gctINT32 Left
** Left coordinate of rectangle to clear.
**
** gctINT32 Top
** Top coordinate of rectangle to clear.
**
** gctINT32 Right
** Right coordinate of rectangle to clear.
**
** gctINT32 Bottom
** Bottom coordinate of rectangle to clear.
**
** gceSURF_FORMAT Format
** Format of surface to clear.
**
** gctUINT32 ClearValue
** Value to be used for clearing the surface.
**
** gctUINT8 ClearMask
** Byte-mask to be used for clearing the surface.
**
** OUTPUT:
**
** Nothing.
*/
gceSTATUS
gcoHARDWARE_ClearSoftware(
IN gcoHARDWARE Hardware,
IN gctPOINTER Address,
IN gctUINT32 Stride,
IN gctINT32 Left,
IN gctINT32 Top,
IN gctINT32 Right,
IN gctINT32 Bottom,
IN gceSURF_FORMAT Format,
IN gctUINT32 ClearValue,
IN gctUINT8 ClearMask
)
{
gceSTATUS status;
gceTILING tiling;
gctUINT32 bytesPerTile, bitsPerPixel;
gctUINT32 offset;
gctUINT8_PTR address;
gctINT32 tileWidth, tileHeight, rowStride;
gctINT32 x, y, tx, ty, bx, by, numPixels;
gctUINT32 channelMask[4];
gcmHEADER_ARG("Hardware=0x%x Address=%x Stride=%d "
"Left=%d Top=%d Right=%d Bottom=%d "
"Format=%d ClearValue=%d ClearMask=%d",
Hardware, Address, Stride,
Left, Top, Right, Bottom,
Format, ClearValue, ClearMask);
/* For a clear that is not tile aligned, our hardware might not be able to
do it. So here is the software implementation. */
/* Verify the rgeuments. */
gcmVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE);
do
{
/* Flush the pipe. */
gcmERR_BREAK(gcoHARDWARE_FlushPipe(Hardware));
/* Commit the command queue. */
gcmERR_BREAK(gcoHARDWARE_Commit(Hardware));
/* Stall the hardware. */
gcmERR_BREAK(gcoHARDWARE_Stall(Hardware));
/* Supertiled destination? */
if ((Stride & 0x80000000U) != 0)
{
/* Set the tiling mode. */
tiling = gcvSUPERTILED;
/* Set the tile size. */
tileWidth = 64;
tileHeight = 64;
/* Remove the supertiled bit. */
Stride &= ~0x80000000U;
}
/* No, query tile size. */
else
{
/* Set the tiling mode. */
tiling = gcvTILED;
/* Query the tile size. */
gcmERR_BREAK(gcoHARDWARE_QueryTileSize(gcvNULL, gcvNULL,
&tileWidth, &tileHeight,
gcvNULL));
}
/* Query pixel depth. */
gcmERR_BREAK(gcoHARDWARE_ConvertFormat(Hardware,
Format,
&bitsPerPixel,
gcvNULL));
/* Compute the number of bytes per tile. */
bytesPerTile = (tileWidth * tileHeight * bitsPerPixel) / 8;
switch (Format)
{
case gcvSURF_X4R4G4B4: /* 12-bit RGB color without alpha channel. */
channelMask[0] = 0x000F;
channelMask[1] = 0x00F0;
channelMask[2] = 0x0F00;
channelMask[3] = 0x0;
break;
case gcvSURF_D16: /* 16-bit Depth. */
case gcvSURF_A4R4G4B4: /* 12-bit RGB color with alpha channel. */
channelMask[0] = 0x000F;
channelMask[1] = 0x00F0;
channelMask[2] = 0x0F00;
channelMask[3] = 0xF000;
break;
case gcvSURF_X1R5G5B5: /* 15-bit RGB color without alpha channel. */
channelMask[0] = 0x001F;
channelMask[1] = 0x03E0;
channelMask[2] = 0x7C00;
channelMask[3] = 0x0;
break;
case gcvSURF_A1R5G5B5: /* 15-bit RGB color with alpha channel. */
channelMask[0] = 0x001F;
channelMask[1] = 0x03E0;
channelMask[2] = 0x7C00;
channelMask[3] = 0x8000;
break;
case gcvSURF_R5G6B5: /* 16-bit RGB color without alpha channel. */
channelMask[0] = 0x001F;
channelMask[1] = 0x07E0;
channelMask[2] = 0xF800;
channelMask[3] = 0x0;
break;
case gcvSURF_D24S8: /* 24-bit Depth with 8 bit Stencil. */
case gcvSURF_D24X8: /* 24-bit Depth with 8 bit Stencil. */
case gcvSURF_X8R8G8B8: /* 24-bit RGB without alpha channel. */
case gcvSURF_A8R8G8B8: /* 24-bit RGB with alpha channel. */
channelMask[0] = 0x000000FF;
channelMask[1] = 0x0000FF00;
channelMask[2] = 0x00FF0000;
channelMask[3] = 0xFF000000;
break;
default:
gcmFOOTER_ARG("status=%d", gcvSTATUS_NOT_SUPPORTED);
return gcvSTATUS_NOT_SUPPORTED;
}
/* Expand 16-bit mask into 32-bit mask. */
if (bitsPerPixel == 16)
{
channelMask[0] = channelMask[0] | (channelMask[0] << 16);
channelMask[1] = channelMask[1] | (channelMask[1] << 16);
channelMask[2] = channelMask[2] | (channelMask[2] << 16);
channelMask[3] = channelMask[3] | (channelMask[3] << 16);
}
/* Create an enclosing tile boundary of our unaligned rectangle. */
tx = (Left / tileWidth) * tileWidth;
ty = (Top / tileHeight) * tileHeight;
bx = gcmALIGN(Right, tileWidth);
by = gcmALIGN(Bottom, tileHeight);
/* Compute the origin offset. */
gcmERR_BREAK(
gcoHARDWARE_ComputeOffset(tx, ty,
Stride,
bitsPerPixel / 8,
tiling, &offset));
address = (gctUINT8_PTR) Address + offset;
/*
+---+---+---+---+---+---+
| | | | | | |
+---+---+---+---+---+---+
| |tx | | | |A |
+---+---+---+---+---+---+
| |A' | | | | |
+---+---+---+---+---+---+
| | | | | bx| |
+---+---+---+---+---+---+
A' = A + tileHeight * Stride - ((bx - tx) / tileWidth) * bytesPerTile)
*/
rowStride = tileHeight * Stride - ((bx - tx) / tileWidth) * bytesPerTile;
x = tx;
y = ty;
numPixels = (bx - tx) * (by - ty);
gcmASSERT(numPixels >= 0);
/* Move x,y in tiled order and loop through all tiles that enclose
this rectangle. */
while (numPixels-- > 0)
{
/* Draw only if x,y within clear rectangle. */
if (bitsPerPixel == 32)
{
if ((x >= Left) && (y >= Top) && (x < Right) && (y < Bottom))
{
switch (ClearMask)
{
case 0x1:
/* Common: Clear stencil only. */
* address = (gctUINT8) ClearValue;
break;
case 0xE:
/* Common: Clear depth only. */
address[1] = (gctUINT8) (ClearValue >> 8);
* (gctUINT16_PTR) &address[2] = (gctUINT16) (ClearValue >> 16);
break;
case 0xF:
/* Common: Clear everything. */
* (gctUINT32_PTR) address = ClearValue;
break;
default:
if (ClearMask & 0x1)
{
/* Clear byte 0. */
address[0] = (gctUINT8) ClearValue;
}
if (ClearMask & 0x2)
{
/* Clear byte 1. */
address[1] = (gctUINT8) (ClearValue >> 8);
}
if (ClearMask & 0x4)
{
/* Clear byte 2. */
address[2] = (gctUINT8) (ClearValue >> 16);
}
if (ClearMask & 0x8)
{
/* Clear byte 3. */
address[3] = (gctUINT8) (ClearValue >> 24);
}
}
}
}
else if (bitsPerPixel == 16)
{
if (((x + 1) >= Left) && (y >= Top) && (x < Right) && (y < Bottom))
{
if ((x + 1) == Right)
{
/* Dont write on Right pixel. */
channelMask[0] = channelMask[0] & 0x0000FFFF;
channelMask[1] = channelMask[1] & 0x0000FFFF;
channelMask[2] = channelMask[2] & 0x0000FFFF;
channelMask[3] = channelMask[3] & 0x0000FFFF;
}
if ((x + 1) == Left)
{
/* Dont write on Left pixel. */
channelMask[0] = channelMask[0] & 0xFFFF0000;
channelMask[1] = channelMask[1] & 0xFFFF0000;
channelMask[2] = channelMask[2] & 0xFFFF0000;
channelMask[3] = channelMask[3] & 0xFFFF0000;
}
if (ClearMask & 0x1)
{
/* Clear byte 0. */
*(gctUINT32_PTR) address = (*(gctUINT32_PTR) address & ~channelMask[0])
| ( ClearValue & channelMask[0]);
}
if (ClearMask & 0x2)
{
/* Clear byte 1. */
*(gctUINT32_PTR) address = (*(gctUINT32_PTR) address & ~channelMask[1])
| ( ClearValue & channelMask[1]);
}
if (ClearMask & 0x4)
{
/* Clear byte 2. */
*(gctUINT32_PTR) address = (*(gctUINT32_PTR) address & ~channelMask[2])
| ( ClearValue & channelMask[2]);
}
if (ClearMask & 0x8)
{
/* Clear byte 3. */
*(gctUINT32_PTR) address = (*(gctUINT32_PTR) address & ~channelMask[3])
| ( ClearValue & channelMask[3]);
}
if ((x + 1) == Left)
{
/* Restore channel mask. */
channelMask[0] = channelMask[0] | (channelMask[0] >> 16);
channelMask[1] = channelMask[1] | (channelMask[1] >> 16);
channelMask[2] = channelMask[2] | (channelMask[2] >> 16);
channelMask[3] = channelMask[3] | (channelMask[3] >> 16);
}
if ((x + 1) == Right)
{
/* Restore channel mask. */
channelMask[0] = channelMask[0] | (channelMask[0] << 16);
channelMask[1] = channelMask[1] | (channelMask[1] << 16);
channelMask[2] = channelMask[2] | (channelMask[2] << 16);
channelMask[3] = channelMask[3] | (channelMask[3] << 16);
}
}
}
/* Increment address and x. */
address += 4;
x += 32 / bitsPerPixel;
/* Verify 4-pixel horizontal boundary. */
if ((x & 0x03) != 0)
{
continue;
}
/******* HORIZONTAL 4-PIXEL BOUNDARY *************************/
/* Update to the next line. */
y += 1;
/* Verify 4-pixel vertical boundary. */
if ((y & 0x03) != 0)
{
/* Go to the next line. */
x -= 4;
continue;
}
/******* VERTICAL 4-PIXEL BOUNDARY ***************************/
/* In supertiled mode? */
if (tiling == gcvSUPERTILED)
{
/* Verify 8x4 horizonal boundary. */
if ((x & 0x04) != 0)
{
/* Go to the next 4x4 column in 8x16 block. */
y -= 4;
continue;
}
/******* 8x4 BOUNDARY ****************************************/
/* Verify 8x16 vertical boundary. */
if ((y & 0x0C) != 0)
{
/* Go back to the first column. */
x -= 8;
continue;
}
/******* 8x16 BOUNDARY ***************************************/
/* Verify 64x16 boundary. */
if ((x & 0x38) != 0)
{
/* Go to the next 8x16 block to the right. */
y -= 16;
continue;
}
/******* 64x16 BOUNDARY **************************************/
/* Verify 64x64 boundary. */
if ((y & 0x30) != 0)
{
/* Go to the first 8x16 block in the 64x64 tile. */
x -= 64;
continue;
}
/******* 64x64 BOUNDARY **************************************/
}
/* At last tile of this row? */
if (x == bx)
{
x = tx;
address += rowStride;
}
else
{
/* Goto to start of first line in next tile. */
y -= tileHeight;
}
}
/* Success. */
status = gcvSTATUS_OK;
}
while (gcvFALSE);
/* Return the status. */
gcmFOOTER();
return status;
}

View File

@ -1,25 +0,0 @@
/****************************************************************************
*
* Copyright (c) 2005 - 2010 by Vivante Corp. All rights reserved.
*
* The material in this file is confidential and contains trade secrets
* of Vivante Corporation. This is proprietary information owned by
* Vivante Corporation. No part of this work may be disclosed,
* reproduced, copied, transmitted, or used in any way for any purpose,
* without the express written permission of Vivante Corporation.
*
*****************************************************************************
*
* Auto-generated file on 11/10/2010. Do not edit!!!
*
*****************************************************************************/
#include "gc_hal_user_hardware_precomp.h"
/* Zone used for header/footer. */
#define _GC_OBJ_ZONE gcvZONE_HARDWARE

View File

@ -1,987 +0,0 @@
/****************************************************************************
*
* Copyright (c) 2005 - 2010 by Vivante Corp. All rights reserved.
*
* The material in this file is confidential and contains trade secrets
* of Vivante Corporation. This is proprietary information owned by
* Vivante Corporation. No part of this work may be disclosed,
* reproduced, copied, transmitted, or used in any way for any purpose,
* without the express written permission of Vivante Corporation.
*
*****************************************************************************
*
* Auto-generated file on 11/10/2010. Do not edit!!!
*
*****************************************************************************/
#include "gc_hal_user_hardware_precomp.h"
#if defined (FP_PRESENT)
/*******************************************************************************
** Conversion macros.
*/
#define gcmCONVERTFLOAT(Value) \
(* (gctUINT32_PTR) &Value)
#define gcmCONVERTFIXED(Value) \
Value
/*******************************************************************************
** Texture function codes.
*/
static gctUINT32 _TextureFunction[] =
{
FP_STAGE_FUNCTION_REPLACE, /* gcvTEXTURE_REPLACE */
FP_STAGE_FUNCTION_MODULATE, /* gcvTEXTURE_MODULATE */
FP_STAGE_FUNCTION_ADD, /* gcvTEXTURE_ADD */
FP_STAGE_FUNCTION_ADD_SIGNED, /* gcvTEXTURE_ADD_SIGNED */
FP_STAGE_FUNCTION_INTERPOLATE, /* gcvTEXTURE_INTERPOLATE */
FP_STAGE_FUNCTION_SUBTRACT, /* gcvTEXTURE_SUBTRACT */
FP_STAGE_FUNCTION_DOT3 /* gcvTEXTURE_DOT3 */
};
static gctUINT32 _TextureSource[] =
{
FP_STAGE_SOURCE_TEXTURE, /* gcvCOLOR_FROM_TEXTURE */
FP_STAGE_SOURCE_CONSTANT, /* gcvCOLOR_FROM_CONSTANT_COLOR */
FP_STAGE_SOURCE_COLOR, /* gcvCOLOR_FROM_PRIMARY_COLOR */
FP_STAGE_SOURCE_PREVIOUS /* gcvCOLOR_FROM_PREVIOUS_COLOR */
};
static gctUINT32 _TextureChannel[] =
{
/* gcvFROM_COLOR */
FP_STAGE_SOURCE_COLOR_CHANNELS,
/* gcvFROM_ONE_MINUS_COLOR */
FP_STAGE_SOURCE_COLOR_CHANNELS | FP_STAGE_SOURCE_INVERSED,
/* gcvFROM_ALPHA */
FP_STAGE_SOURCE_ALPHA_CHANNEL,
/* gcvFROM_ONE_MINUS_ALPHA */
FP_STAGE_SOURCE_ALPHA_CHANNEL | FP_STAGE_SOURCE_INVERSED
};
/*******************************************************************************
**
** _ConvertColor
**
** Color conversion functions.
**
** INPUT:
**
** Red, Green, Blue, Alpha
** Color components to convert.
**
** OUTPUT:
**
** RGBA8 value.
*/
static gctUINT32
_GetSource(
IN gceTEXTURE_SOURCE Source,
IN gceTEXTURE_CHANNEL Channel
)
{
gctUINT32 source = FP_STAGE_SOURCE_OFF;
if ((Source >= 0) && (Source < gcmCOUNTOF(_TextureSource)) &&
(Channel >= 0) && (Channel < gcmCOUNTOF(_TextureChannel)))
{
source
= _TextureSource[Source]
| _TextureChannel[Channel]
| FP_STAGE_SOURCE_ON;
}
return source;
}
/*******************************************************************************
**
** _SetTextureFunction
**
** Configure texture function.
**
** INPUT:
**
** gcoHARDWARE Hardware
** Pointer to the gcoHARDWARE object.
**
** gctUINT32 Address
** Register address.
**
** gceTEXTURE_FUNCTION Function
** Texture function.
**
** gceTEXTURE_SOURCE Source0, Source1, Source2
** The source of the value for the function.
**
** gceTEXTURE_CHANNEL Channel0, Channel1, Channel2
** Determines whether the value comes from the color, alpha channel;
** straight or inversed.
**
** gctINT Scale
** Result scale value.
**
** OUTPUT:
**
** Nothing.
*/
static gceSTATUS
_SetTextureFunction(
IN gcoHARDWARE Hardware,
IN gctUINT32 Address,
IN gceTEXTURE_FUNCTION Function,
IN gceTEXTURE_SOURCE Source0,
IN gceTEXTURE_CHANNEL Channel0,
IN gceTEXTURE_SOURCE Source1,
IN gceTEXTURE_CHANNEL Channel1,
IN gceTEXTURE_SOURCE Source2,
IN gceTEXTURE_CHANNEL Channel2,
IN gctINT Scale
)
{
gctUINT32 config;
gctUINT32 function;
gctUINT32 source0;
gctUINT32 source1;
gctUINT32 source2;
gctUINT32 shift;
/* Translate the texture function. */
if ((Function < 0) || (Function >= gcmCOUNTOF(_TextureFunction)))
{
return gcvSTATUS_INVALID_ARGUMENT;
}
function = _TextureFunction[Function];
/* Determine the sources. */
source0 = _GetSource(Source0, Channel0);
source1 = _GetSource(Source1, Channel1);
source2 = _GetSource(Source2, Channel2);
/* Determine the shift. */
switch (Scale)
{
case 1:
shift = 0;
break;
case 2:
shift = 1;
break;
case 4:
shift = 2;
break;
default:
return gcvSTATUS_INVALID_ARGUMENT;
}
/* Determine the register value. */
config
= ( ((((gctUINT32) (~0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? FP_STAGE_FUNCTION) - (0 ? FP_STAGE_FUNCTION) + 1) == 32) ? ~0 : (~(~0 << ((1 ? FP_STAGE_FUNCTION) - (0 ? FP_STAGE_FUNCTION) + 1))))))) << (0 ? FP_STAGE_FUNCTION))) | (((gctUINT32) ((gctUINT32) ((function)) & ((gctUINT32) ((((1 ? FP_STAGE_FUNCTION) - (0 ? FP_STAGE_FUNCTION) + 1) == 32) ? ~0 : (~(~0 << ((1 ? FP_STAGE_FUNCTION) - (0 ? FP_STAGE_FUNCTION) + 1))))))) << (0 ? FP_STAGE_FUNCTION))) &((((gctUINT32) (~0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? FP_STAGE_MASK_FUNCTION) - (0 ? FP_STAGE_MASK_FUNCTION) + 1) == 32) ? ~0 : (~(~0 << ((1 ? FP_STAGE_MASK_FUNCTION) - (0 ? FP_STAGE_MASK_FUNCTION) + 1))))))) << (0 ? FP_STAGE_MASK_FUNCTION))) | (((gctUINT32) (FP_STAGE_MASK_FUNCTION_ENABLED&((gctUINT32)((((1?FP_STAGE_MASK_FUNCTION)-(0?FP_STAGE_MASK_FUNCTION)+1)==32)?~0:(~(~0<<((1?FP_STAGE_MASK_FUNCTION)-(0?FP_STAGE_MASK_FUNCTION)+1)))))))<<(0?FP_STAGE_MASK_FUNCTION))))
& ( ((((gctUINT32) (~0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? FP_STAGE_SOURCE0) - (0 ? FP_STAGE_SOURCE0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? FP_STAGE_SOURCE0) - (0 ? FP_STAGE_SOURCE0) + 1))))))) << (0 ? FP_STAGE_SOURCE0))) | (((gctUINT32) ((gctUINT32) ((source0)) & ((gctUINT32) ((((1 ? FP_STAGE_SOURCE0) - (0 ? FP_STAGE_SOURCE0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? FP_STAGE_SOURCE0) - (0 ? FP_STAGE_SOURCE0) + 1))))))) << (0 ? FP_STAGE_SOURCE0))) &((((gctUINT32) (~0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? FP_STAGE_MASK_SOURCE0) - (0 ? FP_STAGE_MASK_SOURCE0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? FP_STAGE_MASK_SOURCE0) - (0 ? FP_STAGE_MASK_SOURCE0) + 1))))))) << (0 ? FP_STAGE_MASK_SOURCE0))) | (((gctUINT32) (FP_STAGE_MASK_SOURCE0_ENABLED&((gctUINT32)((((1?FP_STAGE_MASK_SOURCE0)-(0?FP_STAGE_MASK_SOURCE0)+1)==32)?~0:(~(~0<<((1?FP_STAGE_MASK_SOURCE0)-(0?FP_STAGE_MASK_SOURCE0)+1)))))))<<(0?FP_STAGE_MASK_SOURCE0))))
& ( ((((gctUINT32) (~0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? FP_STAGE_SOURCE1) - (0 ? FP_STAGE_SOURCE1) + 1) == 32) ? ~0 : (~(~0 << ((1 ? FP_STAGE_SOURCE1) - (0 ? FP_STAGE_SOURCE1) + 1))))))) << (0 ? FP_STAGE_SOURCE1))) | (((gctUINT32) ((gctUINT32) ((source1)) & ((gctUINT32) ((((1 ? FP_STAGE_SOURCE1) - (0 ? FP_STAGE_SOURCE1) + 1) == 32) ? ~0 : (~(~0 << ((1 ? FP_STAGE_SOURCE1) - (0 ? FP_STAGE_SOURCE1) + 1))))))) << (0 ? FP_STAGE_SOURCE1))) &((((gctUINT32) (~0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? FP_STAGE_MASK_SOURCE1) - (0 ? FP_STAGE_MASK_SOURCE1) + 1) == 32) ? ~0 : (~(~0 << ((1 ? FP_STAGE_MASK_SOURCE1) - (0 ? FP_STAGE_MASK_SOURCE1) + 1))))))) << (0 ? FP_STAGE_MASK_SOURCE1))) | (((gctUINT32) (FP_STAGE_MASK_SOURCE1_ENABLED&((gctUINT32)((((1?FP_STAGE_MASK_SOURCE1)-(0?FP_STAGE_MASK_SOURCE1)+1)==32)?~0:(~(~0<<((1?FP_STAGE_MASK_SOURCE1)-(0?FP_STAGE_MASK_SOURCE1)+1)))))))<<(0?FP_STAGE_MASK_SOURCE1))))
& ( ((((gctUINT32) (~0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? FP_STAGE_SOURCE2) - (0 ? FP_STAGE_SOURCE2) + 1) == 32) ? ~0 : (~(~0 << ((1 ? FP_STAGE_SOURCE2) - (0 ? FP_STAGE_SOURCE2) + 1))))))) << (0 ? FP_STAGE_SOURCE2))) | (((gctUINT32) ((gctUINT32) ((source2)) & ((gctUINT32) ((((1 ? FP_STAGE_SOURCE2) - (0 ? FP_STAGE_SOURCE2) + 1) == 32) ? ~0 : (~(~0 << ((1 ? FP_STAGE_SOURCE2) - (0 ? FP_STAGE_SOURCE2) + 1))))))) << (0 ? FP_STAGE_SOURCE2))) &((((gctUINT32) (~0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? FP_STAGE_MASK_SOURCE2) - (0 ? FP_STAGE_MASK_SOURCE2) + 1) == 32) ? ~0 : (~(~0 << ((1 ? FP_STAGE_MASK_SOURCE2) - (0 ? FP_STAGE_MASK_SOURCE2) + 1))))))) << (0 ? FP_STAGE_MASK_SOURCE2))) | (((gctUINT32) (FP_STAGE_MASK_SOURCE2_ENABLED&((gctUINT32)((((1?FP_STAGE_MASK_SOURCE2)-(0?FP_STAGE_MASK_SOURCE2)+1)==32)?~0:(~(~0<<((1?FP_STAGE_MASK_SOURCE2)-(0?FP_STAGE_MASK_SOURCE2)+1)))))))<<(0?FP_STAGE_MASK_SOURCE2))))
& ( ((((gctUINT32) (~0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? FP_STAGE_SHIFT) - (0 ? FP_STAGE_SHIFT) + 1) == 32) ? ~0 : (~(~0 << ((1 ? FP_STAGE_SHIFT) - (0 ? FP_STAGE_SHIFT) + 1))))))) << (0 ? FP_STAGE_SHIFT))) | (((gctUINT32) ((gctUINT32) ((shift)) & ((gctUINT32) ((((1 ? FP_STAGE_SHIFT) - (0 ? FP_STAGE_SHIFT) + 1) == 32) ? ~0 : (~(~0 << ((1 ? FP_STAGE_SHIFT) - (0 ? FP_STAGE_SHIFT) + 1))))))) << (0 ? FP_STAGE_SHIFT))) &((((gctUINT32) (~0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? FP_STAGE_MASK_SHIFT) - (0 ? FP_STAGE_MASK_SHIFT) + 1) == 32) ? ~0 : (~(~0 << ((1 ? FP_STAGE_MASK_SHIFT) - (0 ? FP_STAGE_MASK_SHIFT) + 1))))))) << (0 ? FP_STAGE_MASK_SHIFT))) | (((gctUINT32) (FP_STAGE_MASK_SHIFT_ENABLED&((gctUINT32)((((1?FP_STAGE_MASK_SHIFT)-(0?FP_STAGE_MASK_SHIFT)+1)==32)?~0:(~(~0<<((1?FP_STAGE_MASK_SHIFT)-(0?FP_STAGE_MASK_SHIFT)+1)))))))<<(0?FP_STAGE_MASK_SHIFT))));
/* Set texture function configuration. */
return gcoHARDWARE_LoadState32(Hardware, Address, config);
}
#endif
/*******************************************************************************
**
** gcoHARDWARE_SetFragmentConfiguration
**
** Set the fragment processor configuration.
**
** INPUT:
**
** gcoHARDWARE Hardware
** Pointer to the gcoHARDWARE object.
**
** gctBOOL ColorFromStream
** Selects whether the fragment color comes from the color stream or
** from the constant.
**
** gctBOOL EnableFog
** Fog enable flag.
**
** gctBOOL EnableSmoothPoint
** Antialiased point enable flag.
**
** gctUINT32 ClipPlanes
** Clip plane enable bits:
** [0] for plane 0;
** [1] for plane 1;
** [2] for plane 2;
** [3] for plane 3;
** [4] for plane 4;
** [5] for plane 5.
**
** OUTPUT:
**
** Nothing.
*/
gceSTATUS
gcoHARDWARE_SetFragmentConfiguration(
IN gcoHARDWARE Hardware,
IN gctBOOL ColorFromStream,
IN gctBOOL EnableFog,
IN gctBOOL EnableSmoothPoint,
IN gctUINT32 ClipPlanes
)
{
#if defined (FP_PRESENT)
gctUINT32 config;
gctBOOL userClipping;
/* Verify the arguments. */
gcmVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE);
/* Determine whether user clipping is enabled. */
userClipping = ((ClipPlanes & 0x3F) != 0);
/* Determine the value. */
config
= ( ((((gctUINT32) (~0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? GCREG_FP_CONFIGURATION_COLOR_FROM_STREAM) - (0 ? GCREG_FP_CONFIGURATION_COLOR_FROM_STREAM) + 1) == 32) ? ~0 : (~(~0 << ((1 ? GCREG_FP_CONFIGURATION_COLOR_FROM_STREAM) - (0 ? GCREG_FP_CONFIGURATION_COLOR_FROM_STREAM) + 1))))))) << (0 ? GCREG_FP_CONFIGURATION_COLOR_FROM_STREAM))) | (((gctUINT32) ((gctUINT32) ((ColorFromStream)) & ((gctUINT32) ((((1 ? GCREG_FP_CONFIGURATION_COLOR_FROM_STREAM) - (0 ? GCREG_FP_CONFIGURATION_COLOR_FROM_STREAM) + 1) == 32) ? ~0 : (~(~0 << ((1 ? GCREG_FP_CONFIGURATION_COLOR_FROM_STREAM) - (0 ? GCREG_FP_CONFIGURATION_COLOR_FROM_STREAM) + 1))))))) << (0 ? GCREG_FP_CONFIGURATION_COLOR_FROM_STREAM))) &((((gctUINT32) (~0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? GCREG_FP_CONFIGURATION_MASK_COLOR_FROM_STREAM) - (0 ? GCREG_FP_CONFIGURATION_MASK_COLOR_FROM_STREAM) + 1) == 32) ? ~0 : (~(~0 << ((1 ? GCREG_FP_CONFIGURATION_MASK_COLOR_FROM_STREAM) - (0 ? GCREG_FP_CONFIGURATION_MASK_COLOR_FROM_STREAM) + 1))))))) << (0 ? GCREG_FP_CONFIGURATION_MASK_COLOR_FROM_STREAM))) | (((gctUINT32) (GCREG_FP_CONFIGURATION_MASK_COLOR_FROM_STREAM_ENABLED&((gctUINT32)((((1?GCREG_FP_CONFIGURATION_MASK_COLOR_FROM_STREAM)-(0?GCREG_FP_CONFIGURATION_MASK_COLOR_FROM_STREAM)+1)==32)?~0:(~(~0<<((1?GCREG_FP_CONFIGURATION_MASK_COLOR_FROM_STREAM)-(0?GCREG_FP_CONFIGURATION_MASK_COLOR_FROM_STREAM)+1)))))))<<(0?GCREG_FP_CONFIGURATION_MASK_COLOR_FROM_STREAM))))
& ( ((((gctUINT32) (~0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? GCREG_FP_CONFIGURATION_FOG) - (0 ? GCREG_FP_CONFIGURATION_FOG) + 1) == 32) ? ~0 : (~(~0 << ((1 ? GCREG_FP_CONFIGURATION_FOG) - (0 ? GCREG_FP_CONFIGURATION_FOG) + 1))))))) << (0 ? GCREG_FP_CONFIGURATION_FOG))) | (((gctUINT32) ((gctUINT32) ((EnableFog)) & ((gctUINT32) ((((1 ? GCREG_FP_CONFIGURATION_FOG) - (0 ? GCREG_FP_CONFIGURATION_FOG) + 1) == 32) ? ~0 : (~(~0 << ((1 ? GCREG_FP_CONFIGURATION_FOG) - (0 ? GCREG_FP_CONFIGURATION_FOG) + 1))))))) << (0 ? GCREG_FP_CONFIGURATION_FOG))) &((((gctUINT32) (~0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? GCREG_FP_CONFIGURATION_MASK_FOG) - (0 ? GCREG_FP_CONFIGURATION_MASK_FOG) + 1) == 32) ? ~0 : (~(~0 << ((1 ? GCREG_FP_CONFIGURATION_MASK_FOG) - (0 ? GCREG_FP_CONFIGURATION_MASK_FOG) + 1))))))) << (0 ? GCREG_FP_CONFIGURATION_MASK_FOG))) | (((gctUINT32) (GCREG_FP_CONFIGURATION_MASK_FOG_ENABLED&((gctUINT32)((((1?GCREG_FP_CONFIGURATION_MASK_FOG)-(0?GCREG_FP_CONFIGURATION_MASK_FOG)+1)==32)?~0:(~(~0<<((1?GCREG_FP_CONFIGURATION_MASK_FOG)-(0?GCREG_FP_CONFIGURATION_MASK_FOG)+1)))))))<<(0?GCREG_FP_CONFIGURATION_MASK_FOG))))
& ( ((((gctUINT32) (~0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? GCREG_FP_CONFIGURATION_SMOOTH_POINT) - (0 ? GCREG_FP_CONFIGURATION_SMOOTH_POINT) + 1) == 32) ? ~0 : (~(~0 << ((1 ? GCREG_FP_CONFIGURATION_SMOOTH_POINT) - (0 ? GCREG_FP_CONFIGURATION_SMOOTH_POINT) + 1))))))) << (0 ? GCREG_FP_CONFIGURATION_SMOOTH_POINT))) | (((gctUINT32) ((gctUINT32) ((EnableSmoothPoint)) & ((gctUINT32) ((((1 ? GCREG_FP_CONFIGURATION_SMOOTH_POINT) - (0 ? GCREG_FP_CONFIGURATION_SMOOTH_POINT) + 1) == 32) ? ~0 : (~(~0 << ((1 ? GCREG_FP_CONFIGURATION_SMOOTH_POINT) - (0 ? GCREG_FP_CONFIGURATION_SMOOTH_POINT) + 1))))))) << (0 ? GCREG_FP_CONFIGURATION_SMOOTH_POINT))) &((((gctUINT32) (~0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? GCREG_FP_CONFIGURATION_MASK_SMOOTH_POINT) - (0 ? GCREG_FP_CONFIGURATION_MASK_SMOOTH_POINT) + 1) == 32) ? ~0 : (~(~0 << ((1 ? GCREG_FP_CONFIGURATION_MASK_SMOOTH_POINT) - (0 ? GCREG_FP_CONFIGURATION_MASK_SMOOTH_POINT) + 1))))))) << (0 ? GCREG_FP_CONFIGURATION_MASK_SMOOTH_POINT))) | (((gctUINT32) (GCREG_FP_CONFIGURATION_MASK_SMOOTH_POINT_ENABLED&((gctUINT32)((((1?GCREG_FP_CONFIGURATION_MASK_SMOOTH_POINT)-(0?GCREG_FP_CONFIGURATION_MASK_SMOOTH_POINT)+1)==32)?~0:(~(~0<<((1?GCREG_FP_CONFIGURATION_MASK_SMOOTH_POINT)-(0?GCREG_FP_CONFIGURATION_MASK_SMOOTH_POINT)+1)))))))<<(0?GCREG_FP_CONFIGURATION_MASK_SMOOTH_POINT))))
& ( ((((gctUINT32) (~0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? GCREG_FP_CONFIGURATION_USER_CLIPPING) - (0 ? GCREG_FP_CONFIGURATION_USER_CLIPPING) + 1) == 32) ? ~0 : (~(~0 << ((1 ? GCREG_FP_CONFIGURATION_USER_CLIPPING) - (0 ? GCREG_FP_CONFIGURATION_USER_CLIPPING) + 1))))))) << (0 ? GCREG_FP_CONFIGURATION_USER_CLIPPING))) | (((gctUINT32) ((gctUINT32) ((userClipping)) & ((gctUINT32) ((((1 ? GCREG_FP_CONFIGURATION_USER_CLIPPING) - (0 ? GCREG_FP_CONFIGURATION_USER_CLIPPING) + 1) == 32) ? ~0 : (~(~0 << ((1 ? GCREG_FP_CONFIGURATION_USER_CLIPPING) - (0 ? GCREG_FP_CONFIGURATION_USER_CLIPPING) + 1))))))) << (0 ? GCREG_FP_CONFIGURATION_USER_CLIPPING))) &((((gctUINT32) (~0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? GCREG_FP_CONFIGURATION_MASK_USER_CLIPPING) - (0 ? GCREG_FP_CONFIGURATION_MASK_USER_CLIPPING) + 1) == 32) ? ~0 : (~(~0 << ((1 ? GCREG_FP_CONFIGURATION_MASK_USER_CLIPPING) - (0 ? GCREG_FP_CONFIGURATION_MASK_USER_CLIPPING) + 1))))))) << (0 ? GCREG_FP_CONFIGURATION_MASK_USER_CLIPPING))) | (((gctUINT32) (GCREG_FP_CONFIGURATION_MASK_USER_CLIPPING_ENABLED&((gctUINT32)((((1?GCREG_FP_CONFIGURATION_MASK_USER_CLIPPING)-(0?GCREG_FP_CONFIGURATION_MASK_USER_CLIPPING)+1)==32)?~0:(~(~0<<((1?GCREG_FP_CONFIGURATION_MASK_USER_CLIPPING)-(0?GCREG_FP_CONFIGURATION_MASK_USER_CLIPPING)+1)))))))<<(0?GCREG_FP_CONFIGURATION_MASK_USER_CLIPPING))))
& ( ((((gctUINT32) (~0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? GCREG_FP_CONFIGURATION_CLIP_PLANES) - (0 ? GCREG_FP_CONFIGURATION_CLIP_PLANES) + 1) == 32) ? ~0 : (~(~0 << ((1 ? GCREG_FP_CONFIGURATION_CLIP_PLANES) - (0 ? GCREG_FP_CONFIGURATION_CLIP_PLANES) + 1))))))) << (0 ? GCREG_FP_CONFIGURATION_CLIP_PLANES))) | (((gctUINT32) ((gctUINT32) ((ClipPlanes)) & ((gctUINT32) ((((1 ? GCREG_FP_CONFIGURATION_CLIP_PLANES) - (0 ? GCREG_FP_CONFIGURATION_CLIP_PLANES) + 1) == 32) ? ~0 : (~(~0 << ((1 ? GCREG_FP_CONFIGURATION_CLIP_PLANES) - (0 ? GCREG_FP_CONFIGURATION_CLIP_PLANES) + 1))))))) << (0 ? GCREG_FP_CONFIGURATION_CLIP_PLANES))) &((((gctUINT32) (~0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? GCREG_FP_CONFIGURATION_MASK_CLIP_PLANES) - (0 ? GCREG_FP_CONFIGURATION_MASK_CLIP_PLANES) + 1) == 32) ? ~0 : (~(~0 << ((1 ? GCREG_FP_CONFIGURATION_MASK_CLIP_PLANES) - (0 ? GCREG_FP_CONFIGURATION_MASK_CLIP_PLANES) + 1))))))) << (0 ? GCREG_FP_CONFIGURATION_MASK_CLIP_PLANES))) | (((gctUINT32) (GCREG_FP_CONFIGURATION_MASK_CLIP_PLANES_ENABLED&((gctUINT32)((((1?GCREG_FP_CONFIGURATION_MASK_CLIP_PLANES)-(0?GCREG_FP_CONFIGURATION_MASK_CLIP_PLANES)+1)==32)?~0:(~(~0<<((1?GCREG_FP_CONFIGURATION_MASK_CLIP_PLANES)-(0?GCREG_FP_CONFIGURATION_MASK_CLIP_PLANES)+1)))))))<<(0?GCREG_FP_CONFIGURATION_MASK_CLIP_PLANES))));
/* Set configuration. */
return gcoHARDWARE_LoadState32(
Hardware,
GCREG_FP_CONFIGURATION_Address,
config
);
#else
return gcvSTATUS_NOT_SUPPORTED;
#endif
}
/*******************************************************************************
**
** gcoHARDWARE_EnableTextureStage
**
** Enable/disable texture stage operation.
**
** INPUT:
**
** gcoHARDWARE Hardware
** Pointer to the gcoHARDWARE object.
**
** gctINT Stage
** Target stage number.
**
** gctBOOL Enable
** Stage enable flag.
**
** OUTPUT:
**
** Nothing.
*/
gceSTATUS
gcoHARDWARE_EnableTextureStage(
IN gcoHARDWARE Hardware,
IN gctINT Stage,
IN gctBOOL Enable
)
{
#if defined (FP_PRESENT)
/* Verify the arguments. */
gcmVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE);
/* Verify the stage number. */
if ((Stage < 0) || (Stage >= 4))
{
return gcvSTATUS_INVALID_ARGUMENT;
}
/* Set configuration. */
return gcoHARDWARE_LoadState32(
Hardware,
GCREG_FP_TEXTURE_Address + Stage * 4,
( ((((gctUINT32) (~0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? GCREG_FP_TEXTURE_STAGE) - (0 ? GCREG_FP_TEXTURE_STAGE) + 1) == 32) ? ~0 : (~(~0 << ((1 ? GCREG_FP_TEXTURE_STAGE) - (0 ? GCREG_FP_TEXTURE_STAGE) + 1))))))) << (0 ? GCREG_FP_TEXTURE_STAGE))) | (((gctUINT32) ((gctUINT32) ((Enable)) & ((gctUINT32) ((((1 ? GCREG_FP_TEXTURE_STAGE) - (0 ? GCREG_FP_TEXTURE_STAGE) + 1) == 32) ? ~0 : (~(~0 << ((1 ? GCREG_FP_TEXTURE_STAGE) - (0 ? GCREG_FP_TEXTURE_STAGE) + 1))))))) << (0 ? GCREG_FP_TEXTURE_STAGE))) &((((gctUINT32) (~0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? GCREG_FP_TEXTURE_MASK_STAGE) - (0 ? GCREG_FP_TEXTURE_MASK_STAGE) + 1) == 32) ? ~0 : (~(~0 << ((1 ? GCREG_FP_TEXTURE_MASK_STAGE) - (0 ? GCREG_FP_TEXTURE_MASK_STAGE) + 1))))))) << (0 ? GCREG_FP_TEXTURE_MASK_STAGE))) | (((gctUINT32) (GCREG_FP_TEXTURE_MASK_STAGE_ENABLED&((gctUINT32)((((1?GCREG_FP_TEXTURE_MASK_STAGE)-(0?GCREG_FP_TEXTURE_MASK_STAGE)+1)==32)?~0:(~(~0<<((1?GCREG_FP_TEXTURE_MASK_STAGE)-(0?GCREG_FP_TEXTURE_MASK_STAGE)+1)))))))<<(0?GCREG_FP_TEXTURE_MASK_STAGE))))
);
#else
return gcvSTATUS_NOT_SUPPORTED;
#endif
}
/*******************************************************************************
**
** gcoHARDWARE_SetTextureColorMask
**
** Program the channel enable masks for the color texture function.
**
** INPUT:
**
** gcoHARDWARE Hardware
** Pointer to the gcoHARDWARE object.
**
** gctINT Stage
** Target stage number.
**
** gctBOOL ColorEnabled
** Determines whether RGB color result from the color texture
** function affects the overall result or should be ignored.
**
** gctBOOL AlphaEnabled
** Determines whether A color result from the color texture
** function affects the overall result or should be ignored.
**
** OUTPUT:
**
** Nothing.
*/
gceSTATUS
gcoHARDWARE_SetTextureColorMask(
IN gcoHARDWARE Hardware,
IN gctINT Stage,
IN gctBOOL ColorEnabled,
IN gctBOOL AlphaEnabled
)
{
#if defined (FP_PRESENT)
gctUINT32 mask = GCREG_FP_TEXTURE_COLOR_ENABLE_NONE;
/* Verify the arguments. */
gcmVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE);
/* Verify the stage number. */
if ((Stage < 0) || (Stage >= 4))
{
return gcvSTATUS_INVALID_ARGUMENT;
}
/* Determine the mask. */
if (ColorEnabled)
{
mask |= GCREG_FP_TEXTURE_COLOR_ENABLE_RGB;
}
if (AlphaEnabled)
{
mask |= GCREG_FP_TEXTURE_COLOR_ENABLE_A;
}
/* Set configuration. */
return gcoHARDWARE_LoadState32(
Hardware,
GCREG_FP_TEXTURE_Address + Stage * 4,
( ((((gctUINT32) (~0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? GCREG_FP_TEXTURE_COLOR_ENABLE) - (0 ? GCREG_FP_TEXTURE_COLOR_ENABLE) + 1) == 32) ? ~0 : (~(~0 << ((1 ? GCREG_FP_TEXTURE_COLOR_ENABLE) - (0 ? GCREG_FP_TEXTURE_COLOR_ENABLE) + 1))))))) << (0 ? GCREG_FP_TEXTURE_COLOR_ENABLE))) | (((gctUINT32) ((gctUINT32) ((mask)) & ((gctUINT32) ((((1 ? GCREG_FP_TEXTURE_COLOR_ENABLE) - (0 ? GCREG_FP_TEXTURE_COLOR_ENABLE) + 1) == 32) ? ~0 : (~(~0 << ((1 ? GCREG_FP_TEXTURE_COLOR_ENABLE) - (0 ? GCREG_FP_TEXTURE_COLOR_ENABLE) + 1))))))) << (0 ? GCREG_FP_TEXTURE_COLOR_ENABLE))) &((((gctUINT32) (~0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? GCREG_FP_TEXTURE_MASK_COLOR_ENABLE) - (0 ? GCREG_FP_TEXTURE_MASK_COLOR_ENABLE) + 1) == 32) ? ~0 : (~(~0 << ((1 ? GCREG_FP_TEXTURE_MASK_COLOR_ENABLE) - (0 ? GCREG_FP_TEXTURE_MASK_COLOR_ENABLE) + 1))))))) << (0 ? GCREG_FP_TEXTURE_MASK_COLOR_ENABLE))) | (((gctUINT32) (GCREG_FP_TEXTURE_MASK_COLOR_ENABLE_ENABLED & ((gctUINT32) ((((1 ? GCREG_FP_TEXTURE_MASK_COLOR_ENABLE) - (0 ? GCREG_FP_TEXTURE_MASK_COLOR_ENABLE) + 1) == 32) ? ~0 : (~(~0 << ((1 ? GCREG_FP_TEXTURE_MASK_COLOR_ENABLE) - (0 ? GCREG_FP_TEXTURE_MASK_COLOR_ENABLE) + 1))))))) << (0 ? GCREG_FP_TEXTURE_MASK_COLOR_ENABLE))))
);
#else
return gcvSTATUS_NOT_SUPPORTED;
#endif
}
/*******************************************************************************
**
** gcoHARDWARE_SetTextureAlphaMask
**
** Program the channel enable masks for the alpha texture function.
**
** INPUT:
**
** gcoHARDWARE Hardware
** Pointer to the gcoHARDWARE object.
**
** gctINT Stage
** Target stage number.
**
** gctBOOL ColorEnabled
** Determines whether RGB color result from the alpha texture
** function affects the overall result or should be ignored.
**
** gctBOOL AlphaEnabled
** Determines whether A color result from the alpha texture
** function affects the overall result or should be ignored.
**
** OUTPUT:
**
** Nothing.
*/
gceSTATUS
gcoHARDWARE_SetTextureAlphaMask(
IN gcoHARDWARE Hardware,
IN gctINT Stage,
IN gctBOOL ColorEnabled,
IN gctBOOL AlphaEnabled
)
{
#if defined (FP_PRESENT)
gctUINT32 mask = GCREG_FP_TEXTURE_ALPHA_ENABLE_NONE;
/* Verify the arguments. */
gcmVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE);
/* Verify the stage number. */
if ((Stage < 0) || (Stage >= 4))
{
return gcvSTATUS_INVALID_ARGUMENT;
}
/* Determine the mask. */
if (ColorEnabled)
{
mask |= GCREG_FP_TEXTURE_ALPHA_ENABLE_RGB;
}
if (AlphaEnabled)
{
mask |= GCREG_FP_TEXTURE_ALPHA_ENABLE_A;
}
/* Set configuration. */
return gcoHARDWARE_LoadState32(
Hardware,
GCREG_FP_TEXTURE_Address + Stage * 4,
( ((((gctUINT32) (~0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? GCREG_FP_TEXTURE_ALPHA_ENABLE) - (0 ? GCREG_FP_TEXTURE_ALPHA_ENABLE) + 1) == 32) ? ~0 : (~(~0 << ((1 ? GCREG_FP_TEXTURE_ALPHA_ENABLE) - (0 ? GCREG_FP_TEXTURE_ALPHA_ENABLE) + 1))))))) << (0 ? GCREG_FP_TEXTURE_ALPHA_ENABLE))) | (((gctUINT32) ((gctUINT32) ((mask)) & ((gctUINT32) ((((1 ? GCREG_FP_TEXTURE_ALPHA_ENABLE) - (0 ? GCREG_FP_TEXTURE_ALPHA_ENABLE) + 1) == 32) ? ~0 : (~(~0 << ((1 ? GCREG_FP_TEXTURE_ALPHA_ENABLE) - (0 ? GCREG_FP_TEXTURE_ALPHA_ENABLE) + 1))))))) << (0 ? GCREG_FP_TEXTURE_ALPHA_ENABLE))) &((((gctUINT32) (~0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? GCREG_FP_TEXTURE_MASK_ALPHA_ENABLE) - (0 ? GCREG_FP_TEXTURE_MASK_ALPHA_ENABLE) + 1) == 32) ? ~0 : (~(~0 << ((1 ? GCREG_FP_TEXTURE_MASK_ALPHA_ENABLE) - (0 ? GCREG_FP_TEXTURE_MASK_ALPHA_ENABLE) + 1))))))) << (0 ? GCREG_FP_TEXTURE_MASK_ALPHA_ENABLE))) | (((gctUINT32) (GCREG_FP_TEXTURE_MASK_ALPHA_ENABLE_ENABLED & ((gctUINT32) ((((1 ? GCREG_FP_TEXTURE_MASK_ALPHA_ENABLE) - (0 ? GCREG_FP_TEXTURE_MASK_ALPHA_ENABLE) + 1) == 32) ? ~0 : (~(~0 << ((1 ? GCREG_FP_TEXTURE_MASK_ALPHA_ENABLE) - (0 ? GCREG_FP_TEXTURE_MASK_ALPHA_ENABLE) + 1))))))) << (0 ? GCREG_FP_TEXTURE_MASK_ALPHA_ENABLE))))
);
#else
return gcvSTATUS_NOT_SUPPORTED;
#endif
}
/*******************************************************************************
**
** gcoHARDWARE_SetFragmentColor
**
** Program the constant fragment color to be used when there is no color
** defined stream.
**
** INPUT:
**
** gcoHARDWARE Hardware
** Pointer to the gcoHARDWARE object.
**
** Red, Green, Blue, Alpha
** Color value to be set.
**
** OUTPUT:
**
** Nothing.
*/
gceSTATUS
gcoHARDWARE_SetFragmentColorX(
IN gcoHARDWARE Hardware,
IN gctFIXED_POINT Red,
IN gctFIXED_POINT Green,
IN gctFIXED_POINT Blue,
IN gctFIXED_POINT Alpha
)
{
#if defined (FP_PRESENT)
gceSTATUS status;
/* Verify the arguments. */
gcmVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE);
do
{
/* Set the color. */
gcmERR_BREAK(gcoHARDWARE_LoadState32(
Hardware,
GCREG_FP_FRAGMENT_RED_X_Address,
gcmCONVERTFIXED(Red)
));
gcmERR_BREAK(gcoHARDWARE_LoadState32(
Hardware,
GCREG_FP_FRAGMENT_GREEN_X_Address,
gcmCONVERTFIXED(Green)
));
gcmERR_BREAK(gcoHARDWARE_LoadState32(
Hardware,
GCREG_FP_FRAGMENT_BLUE_X_Address,
gcmCONVERTFIXED(Blue)
));
gcmERR_BREAK(gcoHARDWARE_LoadState32(
Hardware,
GCREG_FP_FRAGMENT_ALPHA_X_Address,
gcmCONVERTFIXED(Alpha)
));
}
while (gcvFALSE);
/* Return status. */
return status;
#else
return gcvSTATUS_NOT_SUPPORTED;
#endif
}
gceSTATUS
gcoHARDWARE_SetFragmentColorF(
IN gcoHARDWARE Hardware,
IN gctFLOAT Red,
IN gctFLOAT Green,
IN gctFLOAT Blue,
IN gctFLOAT Alpha
)
{
#if defined (FP_PRESENT)
gceSTATUS status;
/* Verify the arguments. */
gcmVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE);
do
{
/* Set the color. */
gcmERR_BREAK(gcoHARDWARE_LoadState32(
Hardware,
GCREG_FP_FRAGMENT_RED_F_Address,
gcmCONVERTFLOAT(Red)
));
gcmERR_BREAK(gcoHARDWARE_LoadState32(
Hardware,
GCREG_FP_FRAGMENT_GREEN_F_Address,
gcmCONVERTFLOAT(Green)
));
gcmERR_BREAK(gcoHARDWARE_LoadState32(
Hardware,
GCREG_FP_FRAGMENT_BLUE_F_Address,
gcmCONVERTFLOAT(Blue)
));
gcmERR_BREAK(gcoHARDWARE_LoadState32(
Hardware,
GCREG_FP_FRAGMENT_ALPHA_F_Address,
gcmCONVERTFLOAT(Alpha)
));
}
while (gcvFALSE);
/* Return status. */
return status;
#else
return gcvSTATUS_NOT_SUPPORTED;
#endif
}
/*******************************************************************************
**
** gcoHARDWARE_SetFogColor
**
** Program the constant fog color to be used in the fog equation when fog
** is enabled.
**
** INPUT:
**
** gcoHARDWARE Hardware
** Pointer to the gcoHARDWARE object.
**
** Red, Green, Blue, Alpha
** Color value to be set.
**
** OUTPUT:
**
** Nothing.
*/
gceSTATUS
gcoHARDWARE_SetFogColorX(
IN gcoHARDWARE Hardware,
IN gctFIXED_POINT Red,
IN gctFIXED_POINT Green,
IN gctFIXED_POINT Blue,
IN gctFIXED_POINT Alpha
)
{
#if defined (FP_PRESENT)
gceSTATUS status;
/* Verify the arguments. */
gcmVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE);
do
{
/* Set the color. */
gcmERR_BREAK(gcoHARDWARE_LoadState32(
Hardware,
GCREG_FP_FOG_RED_X_Address,
gcmCONVERTFIXED(Red)
));
gcmERR_BREAK(gcoHARDWARE_LoadState32(
Hardware,
GCREG_FP_FOG_GREEN_X_Address,
gcmCONVERTFIXED(Green)
));
gcmERR_BREAK(gcoHARDWARE_LoadState32(
Hardware,
GCREG_FP_FOG_BLUE_X_Address,
gcmCONVERTFIXED(Blue)
));
gcmERR_BREAK(gcoHARDWARE_LoadState32(
Hardware,
GCREG_FP_FOG_ALPHA_X_Address,
gcmCONVERTFIXED(Alpha)
));
}
while (gcvFALSE);
/* Return status. */
return status;
#else
return gcvSTATUS_NOT_SUPPORTED;
#endif
}
gceSTATUS
gcoHARDWARE_SetFogColorF(
IN gcoHARDWARE Hardware,
IN gctFLOAT Red,
IN gctFLOAT Green,
IN gctFLOAT Blue,
IN gctFLOAT Alpha
)
{
#if defined (FP_PRESENT)
gceSTATUS status;
/* Verify the arguments. */
gcmVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE);
do
{
/* Set the color. */
gcmERR_BREAK(gcoHARDWARE_LoadState32(
Hardware,
GCREG_FP_FOG_RED_F_Address,
gcmCONVERTFLOAT(Red)
));
gcmERR_BREAK(gcoHARDWARE_LoadState32(
Hardware,
GCREG_FP_FOG_GREEN_F_Address,
gcmCONVERTFLOAT(Green)
));
gcmERR_BREAK(gcoHARDWARE_LoadState32(
Hardware,
GCREG_FP_FOG_BLUE_F_Address,
gcmCONVERTFLOAT(Blue)
));
gcmERR_BREAK(gcoHARDWARE_LoadState32(
Hardware,
GCREG_FP_FOG_ALPHA_F_Address,
gcmCONVERTFLOAT(Alpha)
));
}
while (gcvFALSE);
/* Return status. */
return status;
#else
return gcvSTATUS_NOT_SUPPORTED;
#endif
}
/*******************************************************************************
**
** gcoHARDWARE_SetTetxureColor
**
** Program the constant texture color to be used when selected by the tetxure
** function.
**
** INPUT:
**
** gcoHARDWARE Hardware
** Pointer to the gcoHARDWARE object.
**
** gctINT Stage
** Target stage number.
**
** Red, Green, Blue, Alpha
** Color value to be set.
**
** OUTPUT:
**
** Nothing.
*/
gceSTATUS
gcoHARDWARE_SetTetxureColorX(
IN gcoHARDWARE Hardware,
IN gctINT Stage,
IN gctFIXED_POINT Red,
IN gctFIXED_POINT Green,
IN gctFIXED_POINT Blue,
IN gctFIXED_POINT Alpha
)
{
#if defined (FP_PRESENT)
gceSTATUS status;
/* Verify the arguments. */
gcmVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE);
do
{
/* Determine stage offset. */
gctUINT32 offset = Stage * 4;
/* Set the color. */
gcmERR_BREAK(gcoHARDWARE_LoadState32(
Hardware,
GCREG_FP_TEXTURE_RED_X_Address + offset,
gcmCONVERTFIXED(Red)
));
gcmERR_BREAK(gcoHARDWARE_LoadState32(
Hardware,
GCREG_FP_TEXTURE_GREEN_X_Address + offset,
gcmCONVERTFIXED(Green)
));
gcmERR_BREAK(gcoHARDWARE_LoadState32(
Hardware,
GCREG_FP_TEXTURE_BLUE_X_Address + offset,
gcmCONVERTFIXED(Blue)
));
gcmERR_BREAK(gcoHARDWARE_LoadState32(
Hardware,
GCREG_FP_TEXTURE_ALPHA_X_Address + offset,
gcmCONVERTFIXED(Alpha)
));
}
while (gcvFALSE);
/* Return status. */
return status;
#else
return gcvSTATUS_NOT_SUPPORTED;
#endif
}
gceSTATUS
gcoHARDWARE_SetTetxureColorF(
IN gcoHARDWARE Hardware,
IN gctINT Stage,
IN gctFLOAT Red,
IN gctFLOAT Green,
IN gctFLOAT Blue,
IN gctFLOAT Alpha
)
{
#if defined (FP_PRESENT)
gceSTATUS status;
/* Verify the arguments. */
gcmVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE);
do
{
/* Determine stage offset. */
gctUINT32 offset = Stage * 4;
/* Set the color. */
gcmERR_BREAK(gcoHARDWARE_LoadState32(
Hardware,
GCREG_FP_TEXTURE_RED_F_Address + offset,
gcmCONVERTFLOAT(Red)
));
gcmERR_BREAK(gcoHARDWARE_LoadState32(
Hardware,
GCREG_FP_TEXTURE_GREEN_F_Address + offset,
gcmCONVERTFLOAT(Green)
));
gcmERR_BREAK(gcoHARDWARE_LoadState32(
Hardware,
GCREG_FP_TEXTURE_BLUE_F_Address + offset,
gcmCONVERTFLOAT(Blue)
));
gcmERR_BREAK(gcoHARDWARE_LoadState32(
Hardware,
GCREG_FP_TEXTURE_ALPHA_F_Address + offset,
gcmCONVERTFLOAT(Alpha)
));
}
while (gcvFALSE);
/* Return status. */
return status;
#else
return gcvSTATUS_NOT_SUPPORTED;
#endif
}
/*******************************************************************************
**
** gcoHARDWARE_SetColorTextureFunction
**
** Configure color texture function.
**
** INPUT:
**
** gcoHARDWARE Hardware
** Pointer to the gcoHARDWARE object.
**
** gctINT Stage
** Target stage number.
**
** gceTEXTURE_FUNCTION Function
** Texture function.
**
** gceTEXTURE_SOURCE Source0, Source1, Source2
** The source of the value for the function.
**
** gceTEXTURE_CHANNEL Channel0, Channel1, Channel2
** Determines whether the value comes from the color, alpha channel;
** straight or inversed.
**
** gctINT Scale
** Result scale value.
**
** OUTPUT:
**
** Nothing.
*/
gceSTATUS
gcoHARDWARE_SetColorTextureFunction(
IN gcoHARDWARE Hardware,
IN gctINT Stage,
IN gceTEXTURE_FUNCTION Function,
IN gceTEXTURE_SOURCE Source0,
IN gceTEXTURE_CHANNEL Channel0,
IN gceTEXTURE_SOURCE Source1,
IN gceTEXTURE_CHANNEL Channel1,
IN gceTEXTURE_SOURCE Source2,
IN gceTEXTURE_CHANNEL Channel2,
IN gctINT Scale
)
{
#if defined (FP_PRESENT)
/* Verify the arguments. */
gcmVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE);
/* Verify the stage number. */
if ((Stage < 0) || (Stage >= 4))
{
return gcvSTATUS_INVALID_ARGUMENT;
}
/* Set the texture function. */
return _SetTextureFunction(
Hardware,
GCREG_FP_COLOR_Address + Stage * 4,
Function,
Source0, Channel0,
Source1, Channel1,
Source2, Channel2,
Scale
);
#else
return gcvSTATUS_NOT_SUPPORTED;
#endif
}
/*******************************************************************************
**
** gcoHARDWARE_SetAlphaTextureFunction
**
** Configure alpha texture function.
**
** INPUT:
**
** gcoHARDWARE Hardware
** Pointer to the gcoHARDWARE object.
**
** gctINT Stage
** Target stage number.
**
** gceTEXTURE_FUNCTION Function
** Texture function.
**
** gceTEXTURE_SOURCE Source0, Source1, Source2
** The source of the value for the function.
**
** gceTEXTURE_CHANNEL Channel0, Channel1, Channel2
** Determines whether the value comes from the color, alpha channel;
** straight or inversed.
**
** gctINT Scale
** Result scale value.
**
** OUTPUT:
**
** Nothing.
*/
gceSTATUS
gcoHARDWARE_SetAlphaTextureFunction(
IN gcoHARDWARE Hardware,
IN gctINT Stage,
IN gceTEXTURE_FUNCTION Function,
IN gceTEXTURE_SOURCE Source0,
IN gceTEXTURE_CHANNEL Channel0,
IN gceTEXTURE_SOURCE Source1,
IN gceTEXTURE_CHANNEL Channel1,
IN gceTEXTURE_SOURCE Source2,
IN gceTEXTURE_CHANNEL Channel2,
IN gctINT Scale
)
{
#if defined (FP_PRESENT)
/* Verify the arguments. */
gcmVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE);
/* Verify the stage number. */
if ((Stage < 0) || (Stage >= 4))
{
return gcvSTATUS_INVALID_ARGUMENT;
}
/* Set the texture function. */
return _SetTextureFunction(
Hardware,
GCREG_FP_ALPHA_Address + Stage * 4,
Function,
Source0, Channel0,
Source1, Channel1,
Source2, Channel2,
Scale
);
#else
return gcvSTATUS_NOT_SUPPORTED;
#endif
}

View File

@ -1,481 +0,0 @@
/****************************************************************************
*
* Copyright (c) 2005 - 2010 by Vivante Corp. All rights reserved.
*
* The material in this file is confidential and contains trade secrets
* of Vivante Corporation. This is proprietary information owned by
* Vivante Corporation. No part of this work may be disclosed,
* reproduced, copied, transmitted, or used in any way for any purpose,
* without the express written permission of Vivante Corporation.
*
*****************************************************************************
*
* Auto-generated file on 11/10/2010. Do not edit!!!
*
*****************************************************************************/
#include "gc_hal_user_hardware_precomp.h"
/* Zone used for header/footer. */
#define _GC_OBJ_ZONE gcvZONE_HARDWARE
/*******************************************************************************
**
** gcoHARDWARE_LoadSolidColorPattern
**
** Load solid (single) color pattern.
**
** INPUT:
**
** gcoHARDWARE Hardware
** Pointer to an gcoHARDWARE object.
**
** gctBOOL ColorConvert
** The value of the Color parameter is stored directly in internal
** color register and is used either directly to initialize pattern
** or is converted to the format of destination before it is used.
** The later happens if ColorConvert is gcvTRUE.
**
** gctUINT32 Color
** The color value of the pattern. The value will be used to
** initialize the 8x8 pattern. If the value is in destination format,
** set ColorConvert to gcvFALSE. Otherwise, provide the value in A8R8G8B8
** format and set ColorConvert to gcvTRUE to instruct the hardware to
** convert the value to the destination format before it is actually
** used.
**
** gctUINT64 Mask
** 64 bits of mask, where each bit corresponds to one pixel of the 8x8
** pattern. Each bit of the mask is used to determine transparency of
** the corresponding pixel, in other words, each mask bit is used to
** select between foreground or background ROPs. If the bit is 0,
** background ROP is used on the pixel; if 1, the foreground ROP
** is used. The mapping between Mask parameter bits and actual pattern
** pixels is as follows:
**
** +----+----+----+----+----+----+----+----+
** | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
** +----+----+----+----+----+----+----+----+
** | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 |
** +----+----+----+----+----+----+----+----+
** | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 |
** +----+----+----+----+----+----+----+----+
** | 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 |
** +----+----+----+----+----+----+----+----+
** | 39 | 38 | 37 | 36 | 35 | 34 | 33 | 32 |
** +----+----+----+----+----+----+----+----+
** | 47 | 46 | 45 | 44 | 43 | 42 | 41 | 40 |
** +----+----+----+----+----+----+----+----+
** | 55 | 54 | 53 | 52 | 51 | 50 | 49 | 48 |
** +----+----+----+----+----+----+----+----+
** | 63 | 62 | 61 | 60 | 59 | 58 | 57 | 56 |
** +----+----+----+----+----+----+----+----+
**
** OUTPUT:
**
** Nothing.
*/
gceSTATUS gcoHARDWARE_LoadSolidColorPattern(
IN gcoHARDWARE Hardware,
IN gctBOOL ColorConvert,
IN gctUINT32 Color,
IN gctUINT64 Mask
)
{
gceSTATUS status;
gcmHEADER_ARG("Hardware=0x%x ColorConvert=%d Color=%x Mask=%llx",
Hardware, ColorConvert, Color, Mask);
/* Verify the arguments. */
gcmVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE);
do
{
if (Hardware->hw2DEngine && !Hardware->sw2DEngine)
{
gctUINT32 config;
/* SelectPipe(2D). */
gcmERR_BREAK(gcoHARDWARE_SelectPipe(
Hardware,
0x1
));
/* LoadState(AQDE_PATTERN_MASK, 2), Mask. */
gcmERR_BREAK(gcoHARDWARE_LoadState64(
Hardware,
0x01248, Mask
));
if (!ColorConvert && Hardware->hw2DPE20)
{
/* Convert color to ARGB8 if it was specified in target format. */
gcmERR_BREAK(gcoHARDWARE_ColorConvertToARGB8(
Hardware->targetSurface.format,
1,
&Color,
&Color
));
}
/* LoadState(AQDE_PATTERN_FG_COLOR, 1), Color. */
gcmERR_BREAK(gcoHARDWARE_LoadState32(
Hardware,
0x01254, Color
));
/* Setup pattern configuration. */
config
= ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 4:4) - (0 ? 4:4) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 4:4) - (0 ? 4:4) + 1))))))) << (0 ? 4:4))) | (((gctUINT32) (0x0 & ((gctUINT32) ((((1 ? 4:4) - (0 ? 4:4) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 4:4) - (0 ? 4:4) + 1))))))) << (0 ? 4:4)))
| ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 5:5) - (0 ? 5:5) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 5:5) - (0 ? 5:5) + 1))))))) << (0 ? 5:5))) | (((gctUINT32) ((gctUINT32) (ColorConvert) & ((gctUINT32) ((((1 ? 5:5) - (0 ? 5:5) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 5:5) - (0 ? 5:5) + 1))))))) << (0 ? 5:5)))
| ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 7:6) - (0 ? 7:6) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 7:6) - (0 ? 7:6) + 1))))))) << (0 ? 7:6))) | (((gctUINT32) (0x3 & ((gctUINT32) ((((1 ? 7:6) - (0 ? 7:6) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 7:6) - (0 ? 7:6) + 1))))))) << (0 ? 7:6)));
/* LoadState(AQDE_PATTERN_CONFIG, 1), config. */
gcmERR_BREAK(gcoHARDWARE_LoadState32(
Hardware,
0x0123C, config
));
}
else
{
/* Pattern is not currently supported by the software renderer. */
gcmERR_BREAK(gcvSTATUS_NOT_SUPPORTED);
}
}
while (gcvFALSE);
/* Return the status. */
gcmFOOTER();
return status;
}
/******************************************************************************
**
** gcoHARDWARE_LoadMonochromePattern
**
** Load monochrome pattern.
**
** INPUT:
**
** gcoHARDWARE Hardware
** Pointer to an gcoHARDWARE object.
**
** gctUINT32 OriginX
** gctUINT32 OriginY
** Specifies the origin of the pattern in 0..7 range.
**
** gctBOOL ColorConvert
** The values of FgColor and BgColor parameters are stored directly in
** internal color registers and are used either directly to initialize
** pattern or converted to the format of destination before actually
** used. The later happens if ColorConvert is gcvTRUE.
**
** gctUINT32 FgColor
** gctUINT32 BgColor
** Foreground and background colors of the pattern. The values will be
** used to initialize the 8x8 pattern. If the values are in
** destination format, set ColorConvert to gcvFALSE. Otherwise, provide
** the values in A8R8G8B8 format and set ColorConvert to gcvTRUE to
** instruct the hardware to convert the values to the destination
** format before they are actually used.
**
** gctUINT64 Bits
** 64 bits of pixel bits. Each bit represents one pixel and is used
** to choose between foreground and background colors. If the bit
** is 0, the background color is used; otherwise the foreground color
** is used. The mapping between Bits parameter and the actual pattern
** pixels is the same as of the Mask parameter.
**
** gctUINT64 Mask
** 64 bits of mask, where each bit corresponds to one pixel of the 8x8
** pattern. Each bit of the mask is used to determine transparency of
** the corresponding pixel, in other words, each mask bit is used to
** select between foreground or background ROPs. If the bit is 0,
** background ROP is used on the pixel; if 1, the foreground ROP is
** used. The mapping between Mask parameter bits and the actual
** pattern pixels is as follows:
**
** +----+----+----+----+----+----+----+----+
** | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
** +----+----+----+----+----+----+----+----+
** | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 |
** +----+----+----+----+----+----+----+----+
** | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 |
** +----+----+----+----+----+----+----+----+
** | 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 |
** +----+----+----+----+----+----+----+----+
** | 39 | 38 | 37 | 36 | 35 | 34 | 33 | 32 |
** +----+----+----+----+----+----+----+----+
** | 47 | 46 | 45 | 44 | 43 | 42 | 41 | 40 |
** +----+----+----+----+----+----+----+----+
** | 55 | 54 | 53 | 52 | 51 | 50 | 49 | 48 |
** +----+----+----+----+----+----+----+----+
** | 63 | 62 | 61 | 60 | 59 | 58 | 57 | 56 |
** +----+----+----+----+----+----+----+----+
**
** OUTPUT:
**
** Nothing.
*/
gceSTATUS gcoHARDWARE_LoadMonochromePattern(
IN gcoHARDWARE Hardware,
IN gctUINT32 OriginX,
IN gctUINT32 OriginY,
IN gctBOOL ColorConvert,
IN gctUINT32 FgColor,
IN gctUINT32 BgColor,
IN gctUINT64 Bits,
IN gctUINT64 Mask
)
{
gceSTATUS status;
gcmHEADER_ARG("Hardware=0x%x OriginX=%d OriginY=%d "
"ColorConvert=%d FgColor=%x BgColor=%x "
"Bits=%lld Mask=%llx",
Hardware, OriginX, OriginY,
ColorConvert, FgColor, BgColor,
Bits, Mask);
/* Verify the arguments. */
gcmVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE);
do
{
if (Hardware->hw2DEngine && !Hardware->sw2DEngine)
{
gctUINT32 data[6], config;
/* SelectPipe(2D). */
gcmERR_BREAK(gcoHARDWARE_SelectPipe(
Hardware,
0x1
));
/* Pattern data. */
*(gctUINT64 *) &data[0] = Bits;
/* Mask data. */
*(gctUINT64 *) &data[2] = Mask;
if (!ColorConvert && Hardware->hw2DPE20)
{
/* Convert colors to ARGB8 if they were specified in target format. */
gcmERR_BREAK(gcoHARDWARE_ColorConvertToARGB8(
Hardware->targetSurface.format,
1,
&BgColor,
&BgColor
));
gcmERR_BREAK(gcoHARDWARE_ColorConvertToARGB8(
Hardware->targetSurface.format,
1,
&FgColor,
&FgColor
));
}
/* Backgroud color. */
data[4] = BgColor;
/* Foreground color. */
data[5] = FgColor;
/* LoadState(AQDE_PATTERN_LOW, 6), Bits, Mask, BgColor, FgColor. */
gcmERR_BREAK(gcoHARDWARE_LoadState(
Hardware,
0x01240, 6,
data
));
/* Setup pattern configuration. */
config
= ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 18:16) - (0 ? 18:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 18:16) - (0 ? 18:16) + 1))))))) << (0 ? 18:16))) | (((gctUINT32) ((gctUINT32) (OriginX) & ((gctUINT32) ((((1 ? 18:16) - (0 ? 18:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 18:16) - (0 ? 18:16) + 1))))))) << (0 ? 18:16)))
| ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 22:20) - (0 ? 22:20) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 22:20) - (0 ? 22:20) + 1))))))) << (0 ? 22:20))) | (((gctUINT32) ((gctUINT32) (OriginY) & ((gctUINT32) ((((1 ? 22:20) - (0 ? 22:20) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 22:20) - (0 ? 22:20) + 1))))))) << (0 ? 22:20)))
| ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 5:5) - (0 ? 5:5) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 5:5) - (0 ? 5:5) + 1))))))) << (0 ? 5:5))) | (((gctUINT32) ((gctUINT32) (ColorConvert) & ((gctUINT32) ((((1 ? 5:5) - (0 ? 5:5) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 5:5) - (0 ? 5:5) + 1))))))) << (0 ? 5:5)))
| ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 3:0) - (0 ? 3:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 3:0) - (0 ? 3:0) + 1))))))) << (0 ? 3:0))) | (((gctUINT32) (0xA & ((gctUINT32) ((((1 ? 3:0) - (0 ? 3:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 3:0) - (0 ? 3:0) + 1))))))) << (0 ? 3:0)))
| ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 28:24) - (0 ? 28:24) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 28:24) - (0 ? 28:24) + 1))))))) << (0 ? 28:24))) | (((gctUINT32) (0x0A & ((gctUINT32) ((((1 ? 28:24) - (0 ? 28:24) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 28:24) - (0 ? 28:24) + 1))))))) << (0 ? 28:24)))
| ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 4:4) - (0 ? 4:4) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 4:4) - (0 ? 4:4) + 1))))))) << (0 ? 4:4))) | (((gctUINT32) (0x1 & ((gctUINT32) ((((1 ? 4:4) - (0 ? 4:4) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 4:4) - (0 ? 4:4) + 1))))))) << (0 ? 4:4)))
| ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 7:6) - (0 ? 7:6) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 7:6) - (0 ? 7:6) + 1))))))) << (0 ? 7:6))) | (((gctUINT32) (0x3 & ((gctUINT32) ((((1 ? 7:6) - (0 ? 7:6) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 7:6) - (0 ? 7:6) + 1))))))) << (0 ? 7:6)));
/* LoadState(AQDE_PATTERN_CONFIG, 1), config. */
gcmERR_BREAK(gcoHARDWARE_LoadState32(
Hardware,
0x0123C, config
));
}
else
{
/* Pattern is not currently supported by the software renderer. */
gcmERR_BREAK(gcvSTATUS_NOT_SUPPORTED);
}
}
while (gcvFALSE);
/* Return the status. */
gcmFOOTER();
return status;
}
/******************************************************************************
**
** gcoHARDWARE_LoadColorPattern
**
** Load pattern.
**
** INPUT:
**
** gcoHARDWARE Hardware
** Pointer to an gcoHARDWARE object.
**
** gctUINT32 OriginX
** gctUINT32 OriginY
** Specifies the origin of the pattern in 0..7 range.
**
** gctUINT32 Address
** Location of the pattern bitmap in local memory.
**
** gceSURF_FORMAT Format
** Format of the source bitmap.
**
** gctUINT64 Mask
** 64 bits of mask, where each bit corresponds to one pixel of the 8x8
** pattern. Each bit of the mask is used to determine transparency of
** the corresponding pixel, in other words, each mask bit is used to
** select between foreground or background ROPs. If the bit is 0,
** background ROP is used on the pixel; if 1, the foreground ROP is
** used. The mapping between Mask parameter bits and the actual
** pattern pixels is as follows:
**
** +----+----+----+----+----+----+----+----+
** | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
** +----+----+----+----+----+----+----+----+
** | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 |
** +----+----+----+----+----+----+----+----+
** | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 |
** +----+----+----+----+----+----+----+----+
** | 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 |
** +----+----+----+----+----+----+----+----+
** | 39 | 38 | 37 | 36 | 35 | 34 | 33 | 32 |
** +----+----+----+----+----+----+----+----+
** | 47 | 46 | 45 | 44 | 43 | 42 | 41 | 40 |
** +----+----+----+----+----+----+----+----+
** | 55 | 54 | 53 | 52 | 51 | 50 | 49 | 48 |
** +----+----+----+----+----+----+----+----+
** | 63 | 62 | 61 | 60 | 59 | 58 | 57 | 56 |
** +----+----+----+----+----+----+----+----+
**
** OUTPUT:
**
** Nothing.
*/
gceSTATUS gcoHARDWARE_LoadColorPattern(
IN gcoHARDWARE Hardware,
IN gctUINT32 OriginX,
IN gctUINT32 OriginY,
IN gctUINT32 Address,
IN gceSURF_FORMAT Format,
IN gctUINT64 Mask
)
{
gceSTATUS status;
gcmHEADER_ARG("Hardware=0x%x OriginX=%d OriginY=%d "
"Address=%x Format=%d Mask=%llx",
Hardware, OriginX, OriginY,
Address, Format, Mask);
/* Verify the arguments. */
gcmVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE);
do
{
if (Hardware->hw2DEngine && !Hardware->sw2DEngine)
{
gctUINT32 format, swizzle, isYUVformat, config;
/* Convert the format. */
gcmERR_BREAK(gcoHARDWARE_TranslatePatternFormat(
Hardware, Format, &format, &swizzle, &isYUVformat
));
/* SelectPipe(2D). */
gcmERR_BREAK(gcoHARDWARE_SelectPipe(
Hardware,
0x1
));
/* LoadState(AQDE_PATTERN_MASK_LOW, 2), Mask. */
gcmERR_BREAK(gcoHARDWARE_LoadState64(
Hardware,
0x01248, Mask
));
/* LoadState(AQDE_PATTERN_ADDRESS, 1), Address. */
gcmERR_BREAK(gcoHARDWARE_LoadState32(
Hardware,
0x01238, Address
));
/* Setup pattern configuration. */
config
= ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 18:16) - (0 ? 18:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 18:16) - (0 ? 18:16) + 1))))))) << (0 ? 18:16))) | (((gctUINT32) ((gctUINT32) (OriginX) & ((gctUINT32) ((((1 ? 18:16) - (0 ? 18:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 18:16) - (0 ? 18:16) + 1))))))) << (0 ? 18:16)))
| ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 22:20) - (0 ? 22:20) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 22:20) - (0 ? 22:20) + 1))))))) << (0 ? 22:20))) | (((gctUINT32) ((gctUINT32) (OriginY) & ((gctUINT32) ((((1 ? 22:20) - (0 ? 22:20) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 22:20) - (0 ? 22:20) + 1))))))) << (0 ? 22:20)))
| ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 4:4) - (0 ? 4:4) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 4:4) - (0 ? 4:4) + 1))))))) << (0 ? 4:4))) | (((gctUINT32) (0x1 & ((gctUINT32) ((((1 ? 4:4) - (0 ? 4:4) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 4:4) - (0 ? 4:4) + 1))))))) << (0 ? 4:4)))
| ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 3:0) - (0 ? 3:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 3:0) - (0 ? 3:0) + 1))))))) << (0 ? 3:0))) | (((gctUINT32) ((gctUINT32) (format) & ((gctUINT32) ((((1 ? 3:0) - (0 ? 3:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 3:0) - (0 ? 3:0) + 1))))))) << (0 ? 3:0)))
| ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 28:24) - (0 ? 28:24) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 28:24) - (0 ? 28:24) + 1))))))) << (0 ? 28:24))) | (((gctUINT32) ((gctUINT32) (format) & ((gctUINT32) ((((1 ? 28:24) - (0 ? 28:24) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 28:24) - (0 ? 28:24) + 1))))))) << (0 ? 28:24)))
| ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 7:6) - (0 ? 7:6) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 7:6) - (0 ? 7:6) + 1))))))) << (0 ? 7:6))) | (((gctUINT32) (0x3 & ((gctUINT32) ((((1 ? 7:6) - (0 ? 7:6) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 7:6) - (0 ? 7:6) + 1))))))) << (0 ? 7:6)));
/* Set endian control */
if (Hardware->bigEndian)
{
gctUINT32 bpp;
/* Compute bits per pixel. */
gcmERR_BREAK(gcoHARDWARE_ConvertFormat(Hardware,
Format,
&bpp,
gcvNULL));
if (bpp == 16)
{
config |= ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 31:30) - (0 ? 31:30) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:30) - (0 ? 31:30) + 1))))))) << (0 ? 31:30))) | (((gctUINT32) (0x1 & ((gctUINT32) ((((1 ? 31:30) - (0 ? 31:30) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:30) - (0 ? 31:30) + 1))))))) << (0 ? 31:30)));
}
else if (bpp == 32)
{
config |= ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 31:30) - (0 ? 31:30) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:30) - (0 ? 31:30) + 1))))))) << (0 ? 31:30))) | (((gctUINT32) (0x2 & ((gctUINT32) ((((1 ? 31:30) - (0 ? 31:30) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:30) - (0 ? 31:30) + 1))))))) << (0 ? 31:30)));
}
}
/* LoadState(AQDE_PATTERN_CONFIG, 1), cofig. */
gcmERR_BREAK(gcoHARDWARE_LoadState32(
Hardware,
0x0123C, config
));
}
else
{
/* Pattern is not currently supported by the software renderer. */
gcmERR_BREAK(gcvSTATUS_NOT_SUPPORTED);
}
}
while (gcvFALSE);
/* Return the status. */
gcmFOOTER();
return status;
}

View File

@ -1,97 +0,0 @@
/****************************************************************************
*
* Copyright (c) 2005 - 2010 by Vivante Corp. All rights reserved.
*
* The material in this file is confidential and contains trade secrets
* of Vivante Corporation. This is proprietary information owned by
* Vivante Corporation. No part of this work may be disclosed,
* reproduced, copied, transmitted, or used in any way for any purpose,
* without the express written permission of Vivante Corporation.
*
*****************************************************************************
*
* Auto-generated file on 11/10/2010. Do not edit!!!
*
*****************************************************************************/
#include "gc_hal_user_hardware_precomp.h"
#include "gc_hal_user_context.h"
/* Zone used for header/footer. */
#define _GC_OBJ_ZONE gcvZONE_HARDWARE
/******************************************************************************\
****************************** gcoHARDWARE API Code *****************************
\******************************************************************************/
/*******************************************************************************
**
** AQHWARDWARE_SelectPipe
**
** Select the current pipe for this hardare context.
**
** INPUT:
**
** gcoHARDWARE Hardware
** Pointer to an AQHARWDARE object.
**
** gctUINT8 Pipe
** Pipe to select.
**
** OUTPUT:
**
** Nothing.
*/
gceSTATUS
gcoHARDWARE_SelectPipe(
IN gcoHARDWARE Hardware,
IN gctUINT8 Pipe
)
{
gceSTATUS status;
gcmHEADER_ARG("Hardware=0x%x Pipe=%d", Hardware, Pipe);
/* Verify the arguments. */
gcmVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE);
/* Is 2D pipe present? */
if ((Pipe == 0x1) && !Hardware->hw2DEngine)
{
gcmFOOTER_ARG("status=%d", gcvSTATUS_NOT_SUPPORTED);
return gcvSTATUS_NOT_SUPPORTED;
}
/* Don't do anything if the pipe has already been selected. */
if (Hardware->context->currentPipe == Pipe)
{
/* Success. */
gcmFOOTER_NO();
return gcvSTATUS_OK;
}
/* Flush current pipe. */
gcmVERIFY_OK(gcoHARDWARE_FlushPipe(Hardware));
/* Send sempahore and stall. */
gcmVERIFY_OK(
gcoHARDWARE_Semaphore(Hardware,
gcvWHERE_COMMAND,
gcvWHERE_PIXEL,
gcvHOW_SEMAPHORE_STALL));
/* Perform a load state. */
status = gcoHARDWARE_LoadState32(Hardware,
0x03800,
((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 0:0) - (0 ? 0:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 0:0) - (0 ? 0:0) + 1))))))) << (0 ? 0:0))) | (((gctUINT32) ((gctUINT32) (Pipe) & ((gctUINT32) ((((1 ? 0:0) - (0 ? 0:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 0:0) - (0 ? 0:0) + 1))))))) << (0 ? 0:0))));
/* Return status. */
gcmFOOTER();
return status;
}

View File

@ -1,27 +0,0 @@
/****************************************************************************
*
* Copyright (c) 2005 - 2010 by Vivante Corp. All rights reserved.
*
* The material in this file is confidential and contains trade secrets
* of Vivante Corporation. This is proprietary information owned by
* Vivante Corporation. No part of this work may be disclosed,
* reproduced, copied, transmitted, or used in any way for any purpose,
* without the express written permission of Vivante Corporation.
*
*****************************************************************************
*
* Auto-generated file on 11/10/2010. Do not edit!!!
*
*****************************************************************************/
#ifndef __gc_hal_user_hardware_precomp_h_
#define __gc_hal_user_hardware_precomp_h_
#include "gc_hal_user.h"
#include "gc_hal_user_hardware.h"
#endif /* __gc_hal_user_hardware_precomp_h_ */

View File

@ -1,928 +0,0 @@
/****************************************************************************
*
* Copyright (c) 2005 - 2010 by Vivante Corp. All rights reserved.
*
* The material in this file is confidential and contains trade secrets
* of Vivante Corporation. This is proprietary information owned by
* Vivante Corporation. No part of this work may be disclosed,
* reproduced, copied, transmitted, or used in any way for any purpose,
* without the express written permission of Vivante Corporation.
*
*****************************************************************************
*
* Auto-generated file on 11/10/2010. Do not edit!!!
*
*****************************************************************************/
#include "gc_hal_user_hardware_precomp.h"
/* Zone used for header/footer. */
#define _GC_OBJ_ZONE gcvZONE_HARDWARE
/******************************************************************************\
****************************** gcoHARDWARE API Code *****************************
\******************************************************************************/
/*******************************************************************************
**
** gcoHARDWARE_QueryOpenGL2
**
** Query the OpenGL ES 2.0 capabilities of the hardware.
**
** INPUT:
**
** Nothing.
**
** OUTPUT:
**
** gctBOOL * OpenGL2
** Pointer to a boolean that will specify whether the hardware is
** OpenGL ES 2.0 compliant or not.
*/
gceSTATUS gcoHARDWARE_QueryOpenGL2(
OUT gctBOOL * OpenGL2
)
{
gcmHEADER();
/* Verify the arguments. */
gcmVERIFY_ARGUMENT(OpenGL2 != gcvNULL);
/* Return OpenGL ES 2.0 capability for XAQ2. */
*OpenGL2 = gcvTRUE;
/* Success. */
gcmFOOTER_ARG("*OpenGL2=%d", *OpenGL2);
return gcvSTATUS_OK;
}
/*******************************************************************************
**
** gcoHARDWARE_QueryStreamCaps
**
** Query the stream capabilities of the hardware.
**
** INPUT:
**
** gcoHARDWARE Hardware
** Pointer to a gcoHARDWARE object.
**
** OUTPUT:
**
** gctUINT * MaxAttributes
** Pointer to a variable that will hold the maximum number of
** atrtributes for a primitive on success.
**
** gctUINT * MaxStreamSize
** Pointer to a variable that will hold the maximum number of bytes of
** a stream on success.
**
** gctUINT * NumberOfStreams
** Pointer to a variable that will hold the number of streams on
** success.
**
** gctUINT * Alignment
** Pointer to a variable that will receive the stream alignment
** requirement.
*/
gceSTATUS gcoHARDWARE_QueryStreamCaps(
IN gcoHARDWARE Hardware,
OUT gctUINT32 * MaxAttributes,
OUT gctUINT32 * MaxStreamSize,
OUT gctUINT32 * NumberOfStreams,
OUT gctUINT32 * Alignment
)
{
gcmHEADER_ARG("Hardware=0x%x MaxAttributes=0x%x MaxStreamSize=0x%x "
"NumberOfStreams=0x%x Alignment=0x%x",
Hardware, MaxAttributes, MaxStreamSize,
NumberOfStreams, Alignment);
if (MaxAttributes != gcvNULL)
{
/* Return number of attributes per vertex for XAQ2. */
*MaxAttributes = 10;
}
if (MaxStreamSize != gcvNULL)
{
/* Return maximum number of bytes per vertex for XAQ2. */
*MaxStreamSize = 256;
}
if (NumberOfStreams != gcvNULL)
{
/* Return number of streams for XAQ2. */
*NumberOfStreams = Hardware->streamCount;
}
if (Alignment != gcvNULL)
{
/* Return alignment. */
*Alignment = (Hardware->chipModel == gcv700) ? 128 : 8;
}
/* Success. */
gcmFOOTER_NO();
return gcvSTATUS_OK;
}
/*******************************************************************************
**
** gcoHARDWARE_ConvertFormat
**
** Convert an API format to hardware parameters.
**
** INPUT:
**
** gcoHARDWARE Hardware
** Pointer to the gcoHARDWARE object.
**
** gceSURF_FORMAT Format
** API format to convert.
**
** OUTPUT:
**
** gctUINT32_PTR BitsPerPixel
** Pointer to a variable that will hold the number of bits per pixel.
**
** gctUINT32_PTR BytesPerTile
** Pointer to a variable that will hold the number of bytes per tile.
*/
gceSTATUS gcoHARDWARE_ConvertFormat(
IN gcoHARDWARE Hardware,
IN gceSURF_FORMAT Format,
OUT gctUINT32_PTR BitsPerPixel,
OUT gctUINT32_PTR BytesPerTile
)
{
gctUINT32 bitsPerPixel;
gctUINT32 bytesPerTile;
gcmHEADER_ARG("Hardware=0x%x Format=%d BitsPerPixel=0x%x BytesPerTile=0x%x",
Hardware, Format, BitsPerPixel, BytesPerTile);
/* Verify the arguments. */
gcmVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE);
/* Dispatch on format. */
switch (Format)
{
case gcvSURF_INDEX8:
case gcvSURF_A8:
case gcvSURF_L8:
/* 8-bpp format. */
bitsPerPixel = 8;
bytesPerTile = (8 * 4 * 4) / 8;
break;
case gcvSURF_YV12:
case gcvSURF_I420:
case gcvSURF_NV12:
case gcvSURF_NV21:
/* 12-bpp planar YUV formats. */
bitsPerPixel = 12;
bytesPerTile = (12 * 4 * 4) / 8;
break;
case gcvSURF_A8L8:
case gcvSURF_X4R4G4B4:
case gcvSURF_A4R4G4B4:
case gcvSURF_X1R5G5B5:
case gcvSURF_A1R5G5B5:
case gcvSURF_R5G6B5:
case gcvSURF_YUY2:
case gcvSURF_UYVY:
case gcvSURF_YVYU:
case gcvSURF_VYUY:
case gcvSURF_NV16:
case gcvSURF_NV61:
case gcvSURF_D16:
/* 16-bpp format. */
bitsPerPixel = 16;
bytesPerTile = (16 * 4 * 4) / 8;
break;
case gcvSURF_X8R8G8B8:
case gcvSURF_A8R8G8B8:
case gcvSURF_X8B8G8R8:
case gcvSURF_A8B8G8R8:
case gcvSURF_D24X8:
case gcvSURF_D24S8:
case gcvSURF_D32:
/* 32-bpp format. */
bitsPerPixel = 32;
bytesPerTile = (32 * 4 * 4) / 8;
break;
case gcvSURF_DXT1:
case gcvSURF_ETC1:
bitsPerPixel = 4;
bytesPerTile = (4 * 4 * 4) / 8;
break;
case gcvSURF_DXT2:
case gcvSURF_DXT3:
case gcvSURF_DXT4:
case gcvSURF_DXT5:
bitsPerPixel = 4;
bytesPerTile = (4 * 4 * 4) / 8;
break;
default:
/* Invalid format. */
return gcvSTATUS_INVALID_ARGUMENT;
}
/* Set the result. */
if (BitsPerPixel != gcvNULL)
{
* BitsPerPixel = bitsPerPixel;
}
if (BytesPerTile != gcvNULL)
{
* BytesPerTile = bytesPerTile;
}
/* Success. */
gcmFOOTER_NO();
return gcvSTATUS_OK;
}
/*******************************************************************************
**
** gcoHARDWARE_QueryCommandBuffer
**
** Query the command buffer alignment and number of reserved bytes.
**
** INPUT:
**
** gcoHARDWARE Harwdare
** Pointer to an gcoHARDWARE object.
**
** OUTPUT:
**
** gctSIZE_T * Alignment
** Pointer to a variable receiving the alignment for each command.
**
** gctSIZE_T * ReservedHead
** Pointer to a variable receiving the number of reserved bytes at the
** head of each command buffer.
**
** gctSIZE_T * ReservedTail
** Pointer to a variable receiving the number of bytes reserved at the
** tail of each command buffer.
*/
gceSTATUS gcoHARDWARE_QueryCommandBuffer(
IN gcoHARDWARE Hardware,
OUT gctSIZE_T * Alignment,
OUT gctSIZE_T * ReservedHead,
OUT gctSIZE_T * ReservedTail
)
{
gcmHEADER_ARG("Hardware=0x%x Alignment=0x%x ReservedHead=0x%x ReservedTail=0x%x",
Hardware, Alignment, ReservedHead, ReservedTail);
/* Verify the arguments. */
gcmVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE);
if (Alignment != gcvNULL)
{
/* Align every 8 bytes. */
*Alignment = 8;
}
if (ReservedHead != gcvNULL)
{
/* Reserve space for SelectPipe. */
*ReservedHead = 32;
}
if (ReservedTail != gcvNULL)
{
/* Reserve space for Link(). */
*ReservedTail = 8;
}
/* Success. */
gcmFOOTER_NO();
return gcvSTATUS_OK;
}
/*******************************************************************************
**
** gcoHARDWARE_GetSurfaceTileSize
**
** Query the tile size of the given surface.
**
** INPUT:
**
** Nothing.
**
** OUTPUT:
**
** gctINT32 * TileWidth
** Pointer to a variable receiving the width in pixels per tile.
**
** gctINT32 * TileHeight
** Pointer to a variable receiving the height in pixels per tile.
*/
gceSTATUS gcoHARDWARE_GetSurfaceTileSize(
IN gcsSURF_INFO_PTR Surface,
OUT gctINT32 * TileWidth,
OUT gctINT32 * TileHeight
)
{
gcmHEADER_ARG("Surface=0x%x TileWidth=0x%x TileHeight=0x%x",
Surface, TileWidth, TileHeight);
if (Surface->type == gcvSURF_BITMAP)
{
if (TileWidth != gcvNULL)
{
/* 1 pixel per 2D tile (linear). */
*TileWidth = 1;
}
if (TileHeight != gcvNULL)
{
/* 1 pixel per 2D tile (linear). */
*TileHeight = 1;
}
}
else
{
if (TileWidth != gcvNULL)
{
/* 4 pixels per 3D tile for now. */
*TileWidth = 4;
}
if (TileHeight != gcvNULL)
{
/* 4 lines per 3D tile. */
*TileHeight = 4;
}
}
/* Success. */
gcmFOOTER_NO();
return gcvSTATUS_OK;
}
/*******************************************************************************
**
** gcoHARDWARE_QueryTileSize
**
** Query the tile sizes.
**
** INPUT:
**
** Nothing.
**
** OUTPUT:
**
** gctINT32 * TileWidth2D
** Pointer to a variable receiving the width in pixels per 2D tile. If
** the 2D is working in linear space, the width will be 1. If there is
** no 2D, the width will be 0.
**
** gctINT32 * TileHeight2D
** Pointer to a variable receiving the height in pixels per 2D tile.
** If the 2D is working in linear space, the height will be 1. If
** there is no 2D, the height will be 0.
**
** gctINT32 * TileWidth3D
** Pointer to a variable receiving the width in pixels per 3D tile. If
** the 3D is working in linear space, the width will be 1. If there is
** no 3D, the width will be 0.
**
** gctINT32 * TileHeight3D
** Pointer to a variable receiving the height in pixels per 3D tile.
** If the 3D is working in linear space, the height will be 1. If
** there is no 3D, the height will be 0.
**
** gctUINT32 * Stride
** Pointer to variable receiving the stride requirement for all modes.
*/
gceSTATUS gcoHARDWARE_QueryTileSize(
OUT gctINT32 * TileWidth2D,
OUT gctINT32 * TileHeight2D,
OUT gctINT32 * TileWidth3D,
OUT gctINT32 * TileHeight3D,
OUT gctUINT32 * Stride
)
{
gcmHEADER_ARG("TileWidth2D=0x%x TileHeight2D=0x%x TileWidth3D=0x%x "
"TileHeight3D=0x%x Stride=0x%x",
TileWidth2D, TileHeight2D, TileWidth3D,
TileHeight3D, Stride);
if (TileWidth2D != gcvNULL)
{
/* 1 pixel per 2D tile (linear). */
*TileWidth2D = 1;
}
if (TileHeight2D != gcvNULL)
{
/* 1 pixel per 2D tile (linear). */
*TileHeight2D = 1;
}
if (TileWidth3D != gcvNULL)
{
/* 4 pixels per 3D tile for now. */
*TileWidth3D = 4;
}
if (TileHeight3D != gcvNULL)
{
/* 4 lines per 3D tile. */
*TileHeight3D = 4;
}
if (Stride != gcvNULL)
{
/* 64-byte stride requirement. */
*Stride = 64;
}
/* Success. */
gcmFOOTER_NO();
return gcvSTATUS_OK;
}
/*******************************************************************************
**
** gcoHARDWARE_QueryTextureCaps
**
** Query the texture capabilities.
**
** INPUT:
**
** Nothing.
**
** OUTPUT:
**
** gctUINT * MaxWidth
** Pointer to a variable receiving the maximum width of a texture.
**
** gctUINT * MaxHeight
** Pointer to a variable receiving the maximum height of a texture.
**
** gctUINT * MaxDepth
** Pointer to a variable receiving the maximum depth of a texture. If
** volume textures are not supported, 0 will be returned.
**
** gctBOOL * Cubic
** Pointer to a variable receiving a flag whether the hardware supports
** cubic textures or not.
**
** gctBOOL * NonPowerOfTwo
** Pointer to a variable receiving a flag whether the hardware supports
** non-power-of-two textures or not.
**
** gctUINT * VertexSamplers
** Pointer to a variable receiving the number of sampler units in the
** vertex shader.
**
** gctUINT * PixelSamplers
** Pointer to a variable receiving the number of sampler units in the
** pxiel shader.
*/
gceSTATUS gcoHARDWARE_QueryTextureCaps(
IN gcoHARDWARE Hardware,
OUT gctUINT * MaxWidth,
OUT gctUINT * MaxHeight,
OUT gctUINT * MaxDepth,
OUT gctBOOL * Cubic,
OUT gctBOOL * NonPowerOfTwo,
OUT gctUINT * VertexSamplers,
OUT gctUINT * PixelSamplers
)
{
gcmHEADER_ARG("Hardware=0x%x MaxWidth=0x%x MaxHeight=0x%x MaxDepth=0x%x "
"Cubic=0x%x NonPowerOfTwo=0x%x VertexSamplers=0x%x "
"PixelSamplers=0x%x",
Hardware, MaxWidth, MaxHeight, MaxDepth,
Cubic, NonPowerOfTwo, VertexSamplers,
PixelSamplers);
if (MaxWidth != gcvNULL)
{
/* Maximum texture width for XAQ2. */
*MaxWidth = gcoHARDWARE_IsFeatureAvailable(
Hardware, gcvFEATURE_TEXTURE_8K) ? 8192 : 2048;
}
if (MaxHeight != gcvNULL)
{
/* Maximum texture height for XAQ2. */
*MaxHeight = gcoHARDWARE_IsFeatureAvailable(
Hardware, gcvFEATURE_TEXTURE_8K) ? 8192 : 2048;
}
if (MaxDepth != gcvNULL)
{
/* Maximum texture depth for XAQ2. */
*MaxDepth = 1;
}
if (Cubic != gcvNULL)
{
/* XAQ2 supports cube maps. */
*Cubic = gcvTRUE;
}
if (NonPowerOfTwo != gcvNULL)
{
/* XAQ2 does not support non-power-of-two texture maps. */
*NonPowerOfTwo = gcvFALSE;
}
if (VertexSamplers != gcvNULL)
{
/* Return number of texture samples in the vertex shader for XAQ2. */
*VertexSamplers = 0;
}
if (PixelSamplers != gcvNULL)
{
/* Return number of texture samples in the pixel shader for XAQ2. */
*PixelSamplers = 8;
}
/* Success. */
gcmFOOTER_NO();
return gcvSTATUS_OK;
}
/*******************************************************************************
**
** gcoHARDWARE_QueryTargetCaps
**
** Query the render target capabilities.
**
** INPUT:
**
** gcoHARDWARE Hardware
** Pointer to gcoHARDWARE object.
**
** OUTPUT:
**
** gctUINT * MaxWidth
** Pointer to a variable receiving the maximum width of a render
** target.
**
** gctUINT * MaxHeight
** Pointer to a variable receiving the maximum height of a render
** target.
**
** gctUINT * MultiTargetCount
** Pointer to a variable receiving the number of render targets.
**
** gctUINT * MaxSamples
** Pointer to a variable receiving the maximum number of samples per
** pixel for MSAA.
*/
gceSTATUS
gcoHARDWARE_QueryTargetCaps(
IN gcoHARDWARE Hardware,
OUT gctUINT * MaxWidth,
OUT gctUINT * MaxHeight,
OUT gctUINT * MultiTargetCount,
OUT gctUINT * MaxSamples
)
{
gcmHEADER_ARG("Hardware=0x%x MaxWidth=0x%x MaxHeight=0x%x "
"MultiTargetCount=0x%x MaxSamples=0x%x",
Hardware, MaxWidth, MaxHeight,
MultiTargetCount, MaxSamples);
if (MaxWidth != gcvNULL)
{
/* Return maximum width of render target for XAQ2. */
*MaxWidth = 2048;
}
if (MaxHeight != gcvNULL)
{
/* Return maximum height of render target for XAQ2. */
*MaxHeight = 2048;
}
if (MultiTargetCount != gcvNULL)
{
/* Return number of render targets for XAQ2. */
*MultiTargetCount = 1;
}
if (MaxSamples != gcvNULL)
{
/* Return number of samples per pixel for XAQ2. */
if (((((gctUINT32) (Hardware->chipFeatures)) >> (0 ? 7:7) & ((gctUINT32) ((((1 ? 7:7) - (0 ? 7:7) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 7:7) - (0 ? 7:7) + 1)))))) == (0x1 & ((gctUINT32) ((((1 ? 7:7) - (0 ? 7:7) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 7:7) - (0 ? 7:7) + 1))))))))
{
*MaxSamples = 4;
}
else
{
*MaxSamples = 0;
}
#if USE_SUPER_SAMPLING
if (*MaxSamples == 0)
{
*MaxSamples = 4;
}
#endif
}
/* Success. */
gcmFOOTER_NO();
return gcvSTATUS_OK;
}
/*******************************************************************************
**
** gcoHARDWARE_QueryIndexCaps
**
** Query the index capabilities.
**
** INPUT:
**
** Nothing.
**
** OUTPUT:
**
** gctBOOL * Index8
** Pointer to a variable receiving the capability for 8-bit indices.
**
** gctBOOL * Index16
** Pointer to a variable receiving the capability for 16-bit indices.
** target.
**
** gctBOOL * Index32
** Pointer to a variable receiving the capability for 32-bit indices.
**
** gctUINT * MaxIndex
** Maximum number of indices.
*/
gceSTATUS
gcoHARDWARE_QueryIndexCaps(
OUT gctBOOL * Index8,
OUT gctBOOL * Index16,
OUT gctBOOL * Index32,
OUT gctUINT * MaxIndex
)
{
gcmHEADER_ARG("Index8=0x%x Index16=0x%x Index32=0x%x MaxIndex=0x%x",
Index8, Index16, Index32, MaxIndex);
if (Index8 != gcvNULL)
{
/* XAQ2 supports 8-bit indices. */
*Index8 = gcvTRUE;
}
if (Index16 != gcvNULL)
{
/* XAQ2 supports 16-bit indices. */
*Index16 = gcvTRUE;
}
if (Index32 != gcvNULL)
{
/* XAQ2 does not support 32-bit indices. */
*Index32 = gcvFALSE;
}
if (MaxIndex != gcvNULL)
{
/* XAQ2 supports up to 2**16 indices. */
*MaxIndex = 1 << 16;
}
/* Success. */
gcmFOOTER_NO();
return gcvSTATUS_OK;
}
/*******************************************************************************
**
** gcoHARDWARE_QueryShaderCaps
**
** Query the shader capabilities.
**
** INPUT:
**
** Nothing.
**
** OUTPUT:
**
** gctUINT * VertexUniforms
** Pointer to a variable receiving the number of uniforms in the vertex
** shader.
**
** gctUINT * FragmentUniforms
** Pointer to a variable receiving the number of uniforms in the
** fragment shader.
**
** gctUINT * Varyings
** Pointer to a variable receiving the maimum number of varyings.
*/
gceSTATUS
gcoHARDWARE_QueryShaderCaps(
OUT gctUINT * VertexUniforms,
OUT gctUINT * FragmentUniforms,
OUT gctUINT * Varyings
)
{
gcmHEADER_ARG("VertexUniforms=0x%x FragmentUniforms=0x%x Varyings=0x%x",
VertexUniforms, FragmentUniforms, Varyings);
if (VertexUniforms != gcvNULL)
{
/* XAQ2 has 160 uniforms for the vertex shader. */
*VertexUniforms = 160;
}
if (FragmentUniforms != gcvNULL)
{
/* XAQ2 has 64 uniforms for the fragment shader. */
*FragmentUniforms = 64;
}
if (Varyings != gcvNULL)
{
/* XAQ2 has up to 8 varyings. */
*Varyings = 8;
}
/* Success. */
gcmFOOTER_NO();
return gcvSTATUS_OK;
}
/*******************************************************************************
**
** gcoHARDWARE_QueryTileStatus
**
** Query the linear size for a tile size buffer.
**
** INPUT:
**
** gcoHARDWARE Hardware
** Pointer to gcoHARDWARE object.
**
** gctUINT Width, Height
** Width and height of the surface.
**
** gctSZIE_T Bytes
** Size of the surface in bytes.
**
** OUTPUT:
**
** gctSIZE_T_PTR Size
** Pointer to a variable receiving the number of bytes required to
** store the tile status buffer.
**
** gctSIZE_T_PTR Alignment
** Pointer to a variable receiving the alignment requirement.
**
** gctUINT32_PTR Filler
** Pointer to a variable receiving the tile status filler for fast
** clear.
*/
gceSTATUS
gcoHARDWARE_QueryTileStatus(
IN gcoHARDWARE Hardware,
IN gctUINT Width,
IN gctUINT Height,
IN gctSIZE_T Bytes,
OUT gctSIZE_T_PTR Size,
OUT gctUINT_PTR Alignment,
OUT gctUINT32_PTR Filler
)
{
gctUINT width, height;
gctBOOL is2BitPerTile;
gcmHEADER_ARG("Hardware=0x%x Width=%d Height=%d "
"Bytes=%d Size=0x%x Alignment=0x%x "
"Filler=0x%x",
Hardware, Width, Height,
Bytes, Size, Alignment,
Filler);
/* Verify the arguments. */
gcmVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE);
gcmVERIFY_ARGUMENT(Size != gcvNULL);
/* See if tile status is supported. */
if (!( ((((gctUINT32) (Hardware->chipFeatures)) >> (0 ? 0:0)) & ((gctUINT32) ((((1 ? 0:0) - (0 ? 0:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 0:0) - (0 ? 0:0) + 1)))))) ))
{
gcmFOOTER_ARG("status=%d", gcvSTATUS_NOT_SUPPORTED);
return gcvSTATUS_NOT_SUPPORTED;
}
/* Check tile status size. */
is2BitPerTile = ((((gctUINT32) (Hardware->chipMinorFeatures)) >> (0 ? 10:10) & ((gctUINT32) ((((1 ? 10:10) - (0 ? 10:10) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 10:10) - (0 ? 10:10) + 1)))))) == (0x1 & ((gctUINT32) ((((1 ? 10:10) - (0 ? 10:10) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 10:10) - (0 ? 10:10) + 1)))))));
if ((Hardware->chipModel == gcv500)
&& (Hardware->chipRevision > 2)
)
{
/* Compute the aligned number of tiles for the surface. */
width = gcmALIGN(Width, 4) >> 2;
height = gcmALIGN(Height, 4) >> 2;
/* Return the linear size. */
*Size = gcmALIGN(width * height * 4 / 8, 256);
}
else
{
if ((Width == 0) && (Height == 0))
{
*Size = gcmALIGN(Bytes / 16 / 4, 16 * 4 * 4);
}
else
{
/* Return the linear size. */
*Size = is2BitPerTile ? gcmALIGN(Bytes >> 8, 256)
: gcmALIGN(Bytes >> 7, 256);
}
}
if (Alignment != gcvNULL)
{
/* Set alignment. */
*Alignment = 64;
}
if (Filler != gcvNULL)
{
*Filler = ( (Hardware->chipModel == gcv500)
&& (Hardware->chipRevision > 2)
)
? 0xFFFFFFFF
: is2BitPerTile ? 0x55555555
: 0x11111111;
}
/* Success. */
gcmFOOTER_NO();
return gcvSTATUS_OK;
}
gceSTATUS
gcoHARDWARE_QuerySamplerBase(
IN gcoHARDWARE Hardware,
OUT gctSIZE_T * VertexCount,
OUT gctINT_PTR VertexBase,
OUT gctSIZE_T * FragmentCount,
OUT gctINT_PTR FragmentBase
)
{
gcmHEADER_ARG("Hardware=0x%x VertexCount=0x%x VertexBase=0x%x "
"FragmentCount=0x%x FragmentBase=0x%x",
Hardware, VertexCount, VertexBase,
FragmentCount, FragmentBase);
gcmVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE);
if (VertexCount != gcvNULL)
{
if (Hardware->chipModel > gcv500)
{
*VertexCount = 4;
}
else
{
*VertexCount = 0;
}
}
if (VertexBase != gcvNULL)
{
*VertexBase = 8;
}
if (FragmentCount != gcvNULL)
{
*FragmentCount = 8;
}
if (FragmentBase != gcvNULL)
{
*FragmentBase = 0;
}
/* Success. */
gcmFOOTER_NO();
return gcvSTATUS_OK;
}

View File

@ -1,786 +0,0 @@
/****************************************************************************
*
* Copyright (c) 2005 - 2010 by Vivante Corp. All rights reserved.
*
* The material in this file is confidential and contains trade secrets
* of Vivante Corporation. This is proprietary information owned by
* Vivante Corporation. No part of this work may be disclosed,
* reproduced, copied, transmitted, or used in any way for any purpose,
* without the express written permission of Vivante Corporation.
*
*****************************************************************************
*
* Auto-generated file on 11/10/2010. Do not edit!!!
*
*****************************************************************************/
#include "gc_hal_user_hardware_precomp.h"
/* Zone used for header/footer. */
#define _GC_OBJ_ZONE gcvZONE_HARDWARE
/******************************************************************************\
****************************** gcoHARDWARE API Code *****************************
\******************************************************************************/
/*******************************************************************************
**
** gcoHARDWARE_SetClipping
**
** Set clipping rectangle.
**
** INPUT:
**
** gcoHARDWARE Hardware
** Pointer to an gcoHARDWARE object.
**
* gcsRECT_PTR Rect
** Pointer to a valid destination rectangle. The valid range of the
** coordinates is 0..32768. A pixel is valid if the following is true:
** (pixelX >= Left) && (pixelX < Right) &&
** (pixelY >= Top) && (pixelY < Bottom)
**
** OUTPUT:
**
** Nothing.
*/
gceSTATUS gcoHARDWARE_SetClipping(
IN gcoHARDWARE Hardware,
IN gcsRECT_PTR Rect
)
{
gceSTATUS status;
gcsRECT rect;
gcmHEADER_ARG("Hardware=0x%x Rect=0x%x", Hardware, Rect);
/* Verify the arguments. */
gcmVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE);
/* Reset default if rect is not specified. */
if (Rect == gcvNULL)
{
/* Set to the largest rectangle. */
rect.left = 0;
rect.top = 0;
rect.right = 32767;
rect.bottom = 32767;
Rect = &rect;
}
do
{
if (Hardware->hw2DEngine && !Hardware->sw2DEngine)
{
gctUINT32 data[2];
gcsRECT clippedRect;
/* Clip Rect coordinates in positive range. */
clippedRect.left = gcmMAX(Rect->left, 0);
clippedRect.top = gcmMAX(Rect->top, 0);
clippedRect.right = gcmMAX(Rect->right, 0);
clippedRect.bottom = gcmMAX(Rect->bottom, 0);
/* SelectPipe(2D). */
gcmERR_BREAK(gcoHARDWARE_SelectPipe(
Hardware,
0x1
));
/* 0x01260 */
data[0]
= ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 14:0) - (0 ? 14:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 14:0) - (0 ? 14:0) + 1))))))) << (0 ? 14:0))) | (((gctUINT32) ((gctUINT32) (clippedRect.left) & ((gctUINT32) ((((1 ? 14:0) - (0 ? 14:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 14:0) - (0 ? 14:0) + 1))))))) << (0 ? 14:0)))
| ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 30:16) - (0 ? 30:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 30:16) - (0 ? 30:16) + 1))))))) << (0 ? 30:16))) | (((gctUINT32) ((gctUINT32) (clippedRect.top) & ((gctUINT32) ((((1 ? 30:16) - (0 ? 30:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 30:16) - (0 ? 30:16) + 1))))))) << (0 ? 30:16)));
/* 0x01264 */
data[1]
= ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 14:0) - (0 ? 14:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 14:0) - (0 ? 14:0) + 1))))))) << (0 ? 14:0))) | (((gctUINT32) ((gctUINT32) (clippedRect.right) & ((gctUINT32) ((((1 ? 14:0) - (0 ? 14:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 14:0) - (0 ? 14:0) + 1))))))) << (0 ? 14:0)))
| ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 30:16) - (0 ? 30:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 30:16) - (0 ? 30:16) + 1))))))) << (0 ? 30:16))) | (((gctUINT32) ((gctUINT32) (clippedRect.bottom) & ((gctUINT32) ((((1 ? 30:16) - (0 ? 30:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 30:16) - (0 ? 30:16) + 1))))))) << (0 ? 30:16)));
/* Load cllipping states. */
gcmERR_BREAK(gcoHARDWARE_LoadState(
Hardware, 0x01260, 2,
data
));
}
else
{
/* Store clippig rect for software renderer. */
Hardware->clippingRect = *Rect;
/* Success. */
status = gcvSTATUS_OK;
}
}
while (gcvFALSE);
/* Return the status. */
gcmFOOTER();
return status;
}
/*******************************************************************************
**
** gcoHARDWARE_SetTarget
**
** Configure destination.
**
** INPUT:
**
** gcoHARDWARE Hardware
** Pointer to an gcoHARDWARE object.
**
** gcsSURF_INFO_PTR Surface
** Pointer to the destination surface descriptor.
**
** OUTPUT:
**
** Nothing.
*/
gceSTATUS gcoHARDWARE_SetTarget(
IN gcoHARDWARE Hardware,
IN gcsSURF_INFO_PTR Surface
)
{
gceSTATUS status;
gcmHEADER_ARG("Hardware=0x%x Surface=0x%x", Hardware, Surface);
/* Verify the arguments. */
gcmVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE);
do
{
if (Hardware->hw2DEngine && !Hardware->sw2DEngine)
{
gctUINT32 data[3];
gctUINT32 rotated = 0;
/* Store states for programming the target.
Used later when the command to process is executed.
*/
Hardware->targetSurface = *Surface;
if (Hardware->fullBitBlitRotation)
{
rotated = gcvFALSE;
}
else
{
/* Determine 90 degree rotation enable field. */
if (Surface->rotation == gcvSURF_0_DEGREE)
{
rotated = gcvFALSE;
}
else if (Surface->rotation == gcvSURF_90_DEGREE)
{
rotated = gcvTRUE;
}
else
{
gcmERR_BREAK(gcvSTATUS_NOT_SUPPORTED);
}
}
/* SelectPipe(2D). */
gcmERR_BREAK(gcoHARDWARE_SelectPipe(
Hardware,
0x1
));
/* 0x01228 */
data[0]
= Surface->node.physical;
/* 0x0122C */
data[1]
= Surface->stride;
/* 0x01230 */
data[2]
= ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 15:0) - (0 ? 15:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 15:0) - (0 ? 15:0) + 1))))))) << (0 ? 15:0))) | (((gctUINT32) ((gctUINT32) (Surface->alignedWidth) & ((gctUINT32) ((((1 ? 15:0) - (0 ? 15:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 15:0) - (0 ? 15:0) + 1))))))) << (0 ? 15:0)))
| ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 16:16) - (0 ? 16:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 16:16) - (0 ? 16:16) + 1))))))) << (0 ? 16:16))) | (((gctUINT32) ((gctUINT32) (rotated) & ((gctUINT32) ((((1 ? 16:16) - (0 ? 16:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 16:16) - (0 ? 16:16) + 1))))))) << (0 ? 16:16)));
/* LoadState(AQDE_DEST_ADDRESS, 3), Address, Stride, rotation. */
gcmERR_BREAK(gcoHARDWARE_LoadState(
Hardware,
0x01228, 3,
data
));
if (Hardware->fullBitBlitRotation)
{
gctUINT32 dstRot = 0;
gctUINT32 value;
switch (Surface->rotation)
{
case gcvSURF_0_DEGREE:
dstRot = 0x0;
break;
case gcvSURF_90_DEGREE:
dstRot = 0x4;
break;
case gcvSURF_180_DEGREE:
dstRot = 0x5;
break;
case gcvSURF_270_DEGREE:
dstRot = 0x6;
break;
default:
status = gcvSTATUS_NOT_SUPPORTED;
break;
}
/* Check errors. */
gcmERR_BREAK(status);
/* Flush the 2D pipe before writing to the rotation register. */
gcmERR_BREAK(
gcoHARDWARE_FlushPipe(Hardware));
/* Load target height. */
gcmERR_BREAK(gcoHARDWARE_LoadState32(
Hardware,
0x012B4,
((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 15:0) - (0 ? 15:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 15:0) - (0 ? 15:0) + 1))))))) << (0 ? 15:0))) | (((gctUINT32) ((gctUINT32) (Surface->alignedHeight) & ((gctUINT32) ((((1 ? 15:0) - (0 ? 15:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 15:0) - (0 ? 15:0) + 1))))))) << (0 ? 15:0)))
));
/* 0x012BC */
if (Hardware->shadowRotAngleReg)
{
value = ((((gctUINT32) (Hardware->rotAngleRegShadow)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 5:3) - (0 ? 5:3) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 5:3) - (0 ? 5:3) + 1))))))) << (0 ? 5:3))) | (((gctUINT32) ((gctUINT32) (dstRot) & ((gctUINT32) ((((1 ? 5:3) - (0 ? 5:3) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 5:3) - (0 ? 5:3) + 1))))))) << (0 ? 5:3)));
/* Save the shadow value. */
Hardware->rotAngleRegShadow = value;
}
else
{
value = ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 5:3) - (0 ? 5:3) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 5:3) - (0 ? 5:3) + 1))))))) << (0 ? 5:3))) | (((gctUINT32) ((gctUINT32) (dstRot) & ((gctUINT32) ((((1 ? 5:3) - (0 ? 5:3) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 5:3) - (0 ? 5:3) + 1))))))) << (0 ? 5:3)))
| ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 8:8) - (0 ? 8:8) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 8:8) - (0 ? 8:8) + 1))))))) << (0 ? 8:8))) | (((gctUINT32) (0x1 & ((gctUINT32) ((((1 ? 8:8) - (0 ? 8:8) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 8:8) - (0 ? 8:8) + 1))))))) << (0 ? 8:8)))
| ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 9:9) - (0 ? 9:9) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 9:9) - (0 ? 9:9) + 1))))))) << (0 ? 9:9))) | (((gctUINT32) (0x0&((gctUINT32)((((1?9:9)-(0?9:9)+1)==32)?~0:(~(~0<<((1?9:9)-(0?9:9)+1)))))))<<(0?9:9)));
}
gcmERR_BREAK(gcoHARDWARE_LoadState32(
Hardware,
0x012BC,
value
));
}
}
else
{
gceSURF_FORMAT savedFormat;
/* Rotation is not currently supported by software renderer. */
if (Surface->rotation != gcvSURF_0_DEGREE)
{
gcmERR_BREAK(gcvSTATUS_NOT_SUPPORTED);
}
/* Format is set through gcoHARDWARE_SetTargetFormat function. */
savedFormat = Hardware->targetSurface.format;
/* Store states for software renderer. */
Hardware->targetSurface = *Surface;
/* Restore the format. */
Hardware->targetSurface.format = savedFormat;
/* Success. */
status = gcvSTATUS_OK;
}
}
while (gcvFALSE);
/* Return the status. */
gcmFOOTER();
return status;
}
/*******************************************************************************
**
** gcoHARDWARE_SetTargetFormat
**
** Set the format for the destination surface.
** For PE 2.0, this mode is not needed, format should be set via SetTarget call.
**
** INPUT:
**
** gcoHARDWARE Hardware
** Pointer to an gcoHARDWARE object.
**
** gceSURF_FORMAT Format
** Destination surface format.
**
** OUTPUT:
**
** gceSTATUS
** Returns gcvSTATUS_OK if successful.
*/
gceSTATUS
gcoHARDWARE_SetTargetFormat(
IN gcoHARDWARE Hardware,
IN gceSURF_FORMAT Format
)
{
gceSTATUS status;
gcmHEADER_ARG("Hardware=0x%x Format=%d", Hardware, Format);
/* Verify the arguments. */
gcmVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE);
do
{
if (Hardware->hw2DEngine && !Hardware->sw2DEngine)
{
gctUINT32 format, swizzle, isYUV, endian;
/* Convert the format. */
gcmERR_BREAK(gcoHARDWARE_TranslateDestinationFormat(
Hardware, Format, &format, &swizzle, &isYUV
));
/* Set endian control */
endian = ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 21:20) - (0 ? 21:20) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 21:20) - (0 ? 21:20) + 1))))))) << (0 ? 21:20))) | (((gctUINT32) (0x0 & ((gctUINT32) ((((1 ? 21:20) - (0 ? 21:20) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 21:20) - (0 ? 21:20) + 1))))))) << (0 ? 21:20)));
if (Hardware->bigEndian)
{
gctUINT32 bpp;
/* Compute bits per pixel. */
gcmERR_BREAK(gcoHARDWARE_ConvertFormat(Hardware,
Format,
&bpp,
gcvNULL));
if (bpp == 16)
{
endian = ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 21:20) - (0 ? 21:20) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 21:20) - (0 ? 21:20) + 1))))))) << (0 ? 21:20))) | (((gctUINT32) (0x1 & ((gctUINT32) ((((1 ? 21:20) - (0 ? 21:20) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 21:20) - (0 ? 21:20) + 1))))))) << (0 ? 21:20)));
}
else if (bpp == 32)
{
endian = ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 21:20) - (0 ? 21:20) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 21:20) - (0 ? 21:20) + 1))))))) << (0 ? 21:20))) | (((gctUINT32) (0x2 & ((gctUINT32) ((((1 ? 21:20) - (0 ? 21:20) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 21:20) - (0 ? 21:20) + 1))))))) << (0 ? 21:20)));
}
}
/* SelectPipe(2D). */
gcmERR_BREAK(gcoHARDWARE_SelectPipe(
Hardware,
0x1
));
/* LoadState(AQDE_DEST_CONFIG, 1), config. */
gcmERR_BREAK(gcoHARDWARE_LoadState32(
Hardware,
0x01234,
((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 4:0) - (0 ? 4:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 4:0) - (0 ? 4:0) + 1))))))) << (0 ? 4:0))) | (((gctUINT32) ((gctUINT32) (format) & ((gctUINT32) ((((1 ? 4:0) - (0 ? 4:0) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 4:0) - (0 ? 4:0) + 1))))))) << (0 ? 4:0)))|endian
));
}
else
{
/* Success. */
status = gcvSTATUS_OK;
}
/* Store the format. */
Hardware->targetSurface.format = Format;
}
while (gcvFALSE);
/* Return the status. */
gcmFOOTER();
return status;
}
/*******************************************************************************
**
** gcoHARDWARE_SetTargetColorKeyRange
**
** Setup the destination color key value in A8R8G8B8 format.
** Write to Destination only if the RGB color channels match to the specified color.
**
** INPUT:
**
** gcoHARDWARE Hardware
** Pointer to an gcoHARDWARE object.
**
** gctUINT32 Color
** Destination color.
**
** OUTPUT:
**
** Nothing.
*/
gceSTATUS gcoHARDWARE_SetTargetColorKeyRange(
IN gcoHARDWARE Hardware,
IN gctUINT32 ColorLow,
IN gctUINT32 ColorHigh
)
{
gceSTATUS status;
gcmHEADER_ARG("Hardware=0x%x ColorLow=%x ColorHigh=%x",
Hardware, ColorLow, ColorHigh);
/* Verify the arguments. */
gcmVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE);
do
{
if (Hardware->hw2DEngine && Hardware->hw2DPE20 && !Hardware->sw2DEngine)
{
/* SelectPipe(2D). */
gcmERR_BREAK(gcoHARDWARE_SelectPipe(
Hardware,
0x1
));
/* LoadState global color value. */
gcmERR_BREAK(gcoHARDWARE_LoadState32(
Hardware,
0x012C4,
ColorLow
));
/* LoadState global color value. */
gcmERR_BREAK(gcoHARDWARE_LoadState32(
Hardware,
0x012E0,
ColorHigh
));
}
else
{
/* Not supported by the software renderer. */
gcmERR_BREAK(gcvSTATUS_NOT_SUPPORTED);
}
}
while (gcvFALSE);
/* Return status. */
gcmFOOTER();
return status;
}
/*******************************************************************************
**
** gcoHARDWARE_ColorConvertToARGB8
**
** Convert Color in target format to A8R8G8B8 color.
** Only supports destination formats.
**
** INPUT:
**
** gceSURF_FORMAT Format
** Format of the destination surface.
**
** UINT32 NumColors
** Number of input color values.
**
** UINT32_PTR Color
** Color values in destination format.
**
** OUTPUT:
**
** gctUINT32_PTR Color32
** Color values in ARGB8 format.
*/
gceSTATUS gcoHARDWARE_ColorConvertToARGB8(
IN gceSURF_FORMAT Format,
IN gctUINT32 NumColors,
IN gctUINT32_PTR Color,
OUT gctUINT32_PTR Color32
)
{
gctUINT32 colorR, colorG, colorB, colorA;
gctUINT32 i;
gcmHEADER_ARG("Format=%d NumColors=%d Color=0x%x Color32=0x%x",
Format, NumColors, Color, Color32);
for (i = 0; i < NumColors; i++)
{
gctUINT32 color = Color[i];
gctUINT32_PTR color32 = &Color32[i];
switch(Format)
{
case gcvSURF_X8R8G8B8:
case gcvSURF_A8R8G8B8:
/* No color conversion needed. */
*color32 = color;
continue;
case gcvSURF_A1R5G5B5:
/* Extract colors. */
colorB = (color & 0x1F);
colorG = (color & 0x3E0) >> 5;
colorR = (color & 0x7C00) >> 10;
colorA = (color & 0x8000) >> 15;
/* Expand colors. */
colorB = (colorB << 3) | (colorB >> 2);
colorG = (colorG << 3) | (colorG >> 2);
colorR = (colorR << 3) | (colorR >> 2);
colorA = colorA ? 0xFF : 0x00;
break;
case gcvSURF_X1R5G5B5:
/* Extract colors. */
colorB = (color & 0x1F);
colorG = (color & 0x3E0) >> 5;
colorR = (color & 0x7C00) >> 10;
/* Expand colors. */
colorB = (colorB << 3) | (colorB >> 2);
colorG = (colorG << 3) | (colorG >> 2);
colorR = (colorR << 3) | (colorR >> 2);
colorA = 0xFF;
break;
case gcvSURF_A4R4G4B4:
/* Extract colors. */
colorB = (color & 0xF);
colorG = (color & 0xF0) >> 4;
colorR = (color & 0xF00) >> 8;
colorA = (color & 0xF000) >> 12;
/* Expand colors. */
colorB = colorB | (colorB << 4);
colorG = colorG | (colorG << 4);
colorR = colorR | (colorR << 4);
colorA = colorA | (colorA << 4);
break;
case gcvSURF_X4R4G4B4:
/* Extract colors. */
colorB = (color & 0xF);
colorG = (color & 0xF0) >> 4;
colorR = (color & 0xF00) >> 8;
/* Expand colors. */
colorB = colorB | (colorB << 4);
colorG = colorG | (colorG << 4);
colorR = colorR | (colorR << 4);
colorA = 0xFF;
break;
case gcvSURF_R5G6B5:
/* Extract colors. */
colorB = (color & 0x1F);
colorG = (color & 0x7E0) >> 5;
colorR = (color & 0xF800) >> 11;
/* Expand colors. */
colorB = (colorB << 3) | (colorB >> 2);
colorG = (colorG << 2) | (colorG >> 4);
colorR = (colorR << 3) | (colorR >> 2);
colorA = 0xFF;
break;
default:
return gcvSTATUS_NOT_SUPPORTED;
}
/* Assemble. */
*color32 =
(colorA << 24)
| (colorR << 16)
| (colorG << 8)
| colorB;
}
gcmFOOTER_NO();
return gcvSTATUS_OK;
}
/*******************************************************************************
**
** gcoHARDWARE_ColorConvertFromARGB8
**
** Convert Color in A8R8G8B8 format to target format color.
** Only supports destination formats.
**
** INPUT:
**
** gceSURF_FORMAT Format
** Format of the destination surface.
**
** UINT32 NumColors
** Number of input color values.
**
** UINT32_PTR Color32
** Color values in ARGB8 format.
**
** OUTPUT:
**
** gctUINT32_PTR Color
** Color values in destination format.
*/
gceSTATUS gcoHARDWARE_ColorConvertFromARGB8(
IN gceSURF_FORMAT Format,
IN gctUINT32 NumColors,
IN gctUINT32_PTR Color32,
OUT gctUINT32_PTR Color
)
{
gctUINT32 i;
gcmHEADER_ARG("Format=%d NumColors=%d Color32=0x%x Color=0x%x",
Format, NumColors, Color32, Color);
for (i = 0; i < NumColors; i++)
{
gctUINT32 color32 = Color32[i];
gctUINT32 colorR, colorG, colorB, colorA;
gctUINT32_PTR color = &Color[i];
/* Extract colors. */
colorB = (color32 & 0xFF);
colorG = (color32 & 0xFF00) >> 8;
colorR = (color32 & 0xFF0000) >> 16;
colorA = (color32 & 0xFF000000) >> 24;
switch(Format)
{
case gcvSURF_X8R8G8B8:
case gcvSURF_A8R8G8B8:
/* No color conversion needed. */
*color = color32;
break;
case gcvSURF_A1R5G5B5:
case gcvSURF_X1R5G5B5:
*color =
((colorA >> 7) << 15) |
((colorR >> 3) << 10) |
((colorG >> 3) << 5) |
((colorB >> 3));
/* Expand to 32bit. */
*color = (*color << 16) | *color;
break;
case gcvSURF_A4R4G4B4:
case gcvSURF_X4R4G4B4:
*color =
((colorA >> 4) << 12) |
((colorR >> 4) << 8) |
((colorG >> 4) << 4) |
((colorB >> 4));
/* Expand to 32bit. */
*color = (*color << 16) | *color;
break;
case gcvSURF_R5G6B5:
*color =
((colorR >> 3) << 11) |
((colorG >> 2) << 5) |
((colorB >> 3));
/* Expand to 32bit. */
*color = (*color << 16) | *color;
break;
default:
return gcvSTATUS_NOT_SUPPORTED;
}
}
gcmFOOTER_NO();
return gcvSTATUS_OK;
}
/*******************************************************************************
**
** gcoHARDWARE_ColorPackFromARGB8
**
** Pack Color in A8R8G8B8 format to target format color.
** Needed for backward compatibility.
** Only supports ARGB source formats existing in old PE.
**
** INPUT:
**
** gceSURF_FORMAT Format
** Format of the source surface.
**
** UINT32 Color32
** Color values in ARGB8 format.
**
** OUTPUT:
**
** gctUINT32_PTR Color
** Color values in destination format.
*/
gceSTATUS gcoHARDWARE_ColorPackFromARGB8(
IN gceSURF_FORMAT Format,
IN gctUINT32 Color32,
OUT gctUINT32_PTR Color
)
{
gctUINT32 colorR, colorG, colorB, colorA;
gcmHEADER_ARG("Format=%d Color32=%x Color=0x%x",
Format, Color32, Color);
/* Extract colors. */
colorB = (Color32 & 0xFF);
colorG = (Color32 & 0xFF00) >> 8;
colorR = (Color32 & 0xFF0000) >> 16;
colorA = (Color32 & 0xFF000000) >> 24;
switch(Format)
{
case gcvSURF_X8R8G8B8:
case gcvSURF_A8R8G8B8:
/* No color packing needed. */
*Color = Color32;
break;
case gcvSURF_A1R5G5B5:
case gcvSURF_X1R5G5B5:
*Color =
((colorA & 0x01) << 15) |
((colorR & 0x1F) << 10) |
((colorG & 0x1F) << 5) |
((colorB & 0x1F));
break;
case gcvSURF_A4R4G4B4:
case gcvSURF_X4R4G4B4:
*Color =
((colorA & 0xF) << 12) |
((colorR & 0xF) << 8) |
((colorG & 0xF) << 4) |
((colorB & 0xF));
break;
case gcvSURF_R5G6B5:
*Color =
((colorR & 0x1F) << 11) |
((colorG & 0x3F) << 5) |
((colorB & 0x1F));
break;
default:
return gcvSTATUS_NOT_SUPPORTED;
}
gcmFOOTER_NO();
return gcvSTATUS_OK;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,633 +0,0 @@
/****************************************************************************
*
* Copyright (C) 2005 - 2010 by Vivante Corp.
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*****************************************************************************/
#ifndef __gc_hal_driver_h_
#define __gc_hal_driver_h_
#include "gc_hal_types.h"
#ifdef __cplusplus
extern "C" {
#endif
/******************************************************************************\
******************************* I/O Control Codes ******************************
\******************************************************************************/
#define gcvHAL_CLASS "galcore"
#define IOCTL_GCHAL_INTERFACE 30000
#define IOCTL_GCHAL_KERNEL_INTERFACE 30001
#define IOCTL_GCHAL_TERMINATE 30002
/******************************************************************************\
********************************* Command Codes ********************************
\******************************************************************************/
typedef enum _gceHAL_COMMAND_CODES
{
/* Generic query. */
gcvHAL_QUERY_VIDEO_MEMORY,
gcvHAL_QUERY_CHIP_IDENTITY,
/* Contiguous memory. */
gcvHAL_ALLOCATE_NON_PAGED_MEMORY,
gcvHAL_FREE_NON_PAGED_MEMORY,
gcvHAL_ALLOCATE_CONTIGUOUS_MEMORY,
gcvHAL_FREE_CONTIGUOUS_MEMORY,
/* Video memory allocation. */
gcvHAL_ALLOCATE_VIDEO_MEMORY, /* Enforced alignment. */
gcvHAL_ALLOCATE_LINEAR_VIDEO_MEMORY, /* No alignment. */
gcvHAL_FREE_VIDEO_MEMORY,
/* Physical-to-logical mapping. */
gcvHAL_MAP_MEMORY,
gcvHAL_UNMAP_MEMORY,
/* Logical-to-physical mapping. */
gcvHAL_MAP_USER_MEMORY,
gcvHAL_UNMAP_USER_MEMORY,
/* Surface lock/unlock. */
gcvHAL_LOCK_VIDEO_MEMORY,
gcvHAL_UNLOCK_VIDEO_MEMORY,
/* Event queue. */
gcvHAL_EVENT_COMMIT,
gcvHAL_USER_SIGNAL,
gcvHAL_SIGNAL,
gcvHAL_WRITE_DATA,
gcvHAL_COMMIT,
gcvHAL_STALL,
gcvHAL_READ_REGISTER,
gcvHAL_WRITE_REGISTER,
gcvHAL_GET_PROFILE_SETTING,
gcvHAL_SET_PROFILE_SETTING,
gcvHAL_READ_ALL_PROFILE_REGISTERS,
gcvHAL_PROFILE_REGISTERS_2D,
/* Power management. */
gcvHAL_SET_POWER_MANAGEMENT_STATE,
gcvHAL_QUERY_POWER_MANAGEMENT_STATE,
gcvHAL_GET_BASE_ADDRESS,
gcvHAL_SET_IDLE, /* reserved */
/* Queries. */
gcvHAL_QUERY_KERNEL_SETTINGS,
/* Reset. */
gcvHAL_RESET,
/* Map physical address into handle. */
gcvHAL_MAP_PHYSICAL,
/* Debugger stuff. */
gcvHAL_DEBUG,
/* Cache stuff. */
gcvHAL_CACHE,
}
gceHAL_COMMAND_CODES;
/******************************************************************************\
****************************** Interface Structure *****************************
\******************************************************************************/
#define gcdMAX_PROFILE_FILE_NAME 128
typedef struct _gcsHAL_INTERFACE
{
/* Command code. */
gceHAL_COMMAND_CODES command;
/* Status value. */
gceSTATUS status;
/* Handle to this interface channel. */
gctHANDLE handle;
/* Pid of the client. */
gctUINT32 pid;
/* Union of command structures. */
union _u
{
/* gcvHAL_GET_BASE_ADDRESS */
struct _gcsHAL_GET_BASE_ADDRESS
{
/* Physical memory address of internal memory. */
OUT gctUINT32 baseAddress;
}
GetBaseAddress;
/* gcvHAL_QUERY_VIDEO_MEMORY */
struct _gcsHAL_QUERY_VIDEO_MEMORY
{
/* Physical memory address of internal memory. */
OUT gctPHYS_ADDR internalPhysical;
/* Size in bytes of internal memory.*/
OUT gctSIZE_T internalSize;
/* Physical memory address of external memory. */
OUT gctPHYS_ADDR externalPhysical;
/* Size in bytes of external memory.*/
OUT gctSIZE_T externalSize;
/* Physical memory address of contiguous memory. */
OUT gctPHYS_ADDR contiguousPhysical;
/* Size in bytes of contiguous memory.*/
OUT gctSIZE_T contiguousSize;
}
QueryVideoMemory;
/* gcvHAL_QUERY_CHIP_IDENTITY */
struct _gcsHAL_QUERY_CHIP_IDENTITY
{
/* Chip model. */
OUT gceCHIPMODEL chipModel;
/* Revision value.*/
OUT gctUINT32 chipRevision;
/* Supported feature fields. */
OUT gctUINT32 chipFeatures;
/* Supported minor feature fields. */
OUT gctUINT32 chipMinorFeatures;
/* Supported minor feature 1 fields. */
OUT gctUINT32 chipMinorFeatures1;
/* Number of streams supported. */
OUT gctUINT32 streamCount;
/* Total number of temporary registers per thread. */
OUT gctUINT32 registerMax;
/* Maximum number of threads. */
OUT gctUINT32 threadCount;
/* Number of shader cores. */
OUT gctUINT32 shaderCoreCount;
/* Size of the vertex cache. */
OUT gctUINT32 vertexCacheSize;
/* Number of entries in the vertex output buffer. */
OUT gctUINT32 vertexOutputBufferSize;
}
QueryChipIdentity;
/* gcvHAL_MAP_MEMORY */
struct _gcsHAL_MAP_MEMORY
{
/* Physical memory address to map. */
IN gctPHYS_ADDR physical;
/* Number of bytes in physical memory to map. */
IN gctSIZE_T bytes;
/* Address of mapped memory. */
OUT gctPOINTER logical;
}
MapMemory;
/* gcvHAL_UNMAP_MEMORY */
struct _gcsHAL_UNMAP_MEMORY
{
/* Physical memory address to unmap. */
IN gctPHYS_ADDR physical;
/* Number of bytes in physical memory to unmap. */
IN gctSIZE_T bytes;
/* Address of mapped memory to unmap. */
IN gctPOINTER logical;
}
UnmapMemory;
/* gcvHAL_ALLOCATE_LINEAR_VIDEO_MEMORY */
struct _gcsHAL_ALLOCATE_LINEAR_VIDEO_MEMORY
{
/* Number of bytes to allocate. */
IN OUT gctUINT bytes;
/* Buffer alignment. */
IN gctUINT alignment;
/* Type of allocation. */
IN gceSURF_TYPE type;
/* Memory pool to allocate from. */
IN OUT gcePOOL pool;
/* Allocated video memory. */
OUT gcuVIDMEM_NODE_PTR node;
}
AllocateLinearVideoMemory;
/* gcvHAL_ALLOCATE_VIDEO_MEMORY */
struct _gcsHAL_ALLOCATE_VIDEO_MEMORY
{
/* Width of rectangle to allocate. */
IN OUT gctUINT width;
/* Height of rectangle to allocate. */
IN OUT gctUINT height;
/* Depth of rectangle to allocate. */
IN gctUINT depth;
/* Format rectangle to allocate in gceSURF_FORMAT. */
IN gceSURF_FORMAT format;
/* Type of allocation. */
IN gceSURF_TYPE type;
/* Memory pool to allocate from. */
IN OUT gcePOOL pool;
/* Allocated video memory. */
OUT gcuVIDMEM_NODE_PTR node;
}
AllocateVideoMemory;
/* gcvHAL_FREE_VIDEO_MEMORY */
struct _gcsHAL_FREE_VIDEO_MEMORY
{
/* Allocated video memory. */
IN gcuVIDMEM_NODE_PTR node;
#ifdef __QNXNTO__
/* TODO: This is part of the unlock - why is it here? */
/* Mapped logical address to unmap in user space. */
OUT gctPOINTER memory;
/* Number of bytes to allocated. */
OUT gctSIZE_T bytes;
#endif
}
FreeVideoMemory;
/* gcvHAL_LOCK_VIDEO_MEMORY */
struct _gcsHAL_LOCK_VIDEO_MEMORY
{
/* Allocated video memory. */
IN gcuVIDMEM_NODE_PTR node;
/* Hardware specific address. */
OUT gctUINT32 address;
/* Mapped logical address. */
OUT gctPOINTER memory;
}
LockVideoMemory;
/* gcvHAL_UNLOCK_VIDEO_MEMORY */
struct _gcsHAL_UNLOCK_VIDEO_MEMORY
{
/* Allocated video memory. */
IN gcuVIDMEM_NODE_PTR node;
/* Type of surface. */
IN gceSURF_TYPE type;
/* Flag to unlock surface asynchroneously. */
IN OUT gctBOOL asynchroneous;
}
UnlockVideoMemory;
/* gcvHAL_ALLOCATE_NON_PAGED_MEMORY */
struct _gcsHAL_ALLOCATE_NON_PAGED_MEMORY
{
/* Number of bytes to allocate. */
IN OUT gctSIZE_T bytes;
/* Physical address of allocation. */
OUT gctPHYS_ADDR physical;
/* Logical address of allocation. */
OUT gctPOINTER logical;
}
AllocateNonPagedMemory;
/* gcvHAL_FREE_NON_PAGED_MEMORY */
struct _gcsHAL_FREE_NON_PAGED_MEMORY
{
/* Number of bytes allocated. */
IN gctSIZE_T bytes;
/* Physical address of allocation. */
IN gctPHYS_ADDR physical;
/* Logical address of allocation. */
IN gctPOINTER logical;
}
FreeNonPagedMemory;
/* gcvHAL_EVENT_COMMIT. */
struct _gcsHAL_EVENT_COMMIT
{
/* Event queue. */
IN struct _gcsQUEUE * queue;
}
Event;
/* gcvHAL_COMMIT */
struct _gcsHAL_COMMIT
{
/* Command buffer. */
IN gcoCMDBUF commandBuffer;
/* Context buffer. */
IN gcoCONTEXT contextBuffer;
/* Process handle. */
IN gctHANDLE process;
}
Commit;
/* gcvHAL_MAP_USER_MEMORY */
struct _gcsHAL_MAP_USER_MEMORY
{
/* Base address of user memory to map. */
IN gctPOINTER memory;
/* Size of user memory in bytes to map. */
IN gctSIZE_T size;
/* Info record required by gcvHAL_UNMAP_USER_MEMORY. */
OUT gctPOINTER info;
/* Physical address of mapped memory. */
OUT gctUINT32 address;
}
MapUserMemory;
/* gcvHAL_UNMAP_USER_MEMORY */
struct _gcsHAL_UNMAP_USER_MEMORY
{
/* Base address of user memory to unmap. */
IN gctPOINTER memory;
/* Size of user memory in bytes to unmap. */
IN gctSIZE_T size;
/* Info record returned by gcvHAL_MAP_USER_MEMORY. */
IN gctPOINTER info;
/* Physical address of mapped memory as returned by
gcvHAL_MAP_USER_MEMORY. */
IN gctUINT32 address;
}
UnmapUserMemory;
#if !USE_NEW_LINUX_SIGNAL
/* gcsHAL_USER_SIGNAL */
struct _gcsHAL_USER_SIGNAL
{
/* Command. */
gceUSER_SIGNAL_COMMAND_CODES command;
/* Signal ID. */
IN OUT gctINT id;
/* Reset mode. */
IN gctBOOL manualReset;
/* Wait timedout. */
IN gctUINT32 wait;
/* State. */
IN gctBOOL state;
}
UserSignal;
#endif
/* gcvHAL_SIGNAL. */
struct _gcsHAL_SIGNAL
{
/* Signal handle to signal. */
IN gctSIGNAL signal;
/* Reserved. */
IN gctSIGNAL auxSignal;
/* Process owning the signal. */
IN gctHANDLE process;
#if defined(__QNXNTO__)
/* Client pulse side-channel connection ID. Set by client in gcoOS_CreateSignal. */
IN gctINT32 coid;
/* Set by server. */
IN gctINT32 rcvid;
#endif
/* Event generated from where of pipeline */
IN gceKERNEL_WHERE fromWhere;
}
Signal;
/* gcvHAL_WRITE_DATA. */
struct _gcsHAL_WRITE_DATA
{
/* Address to write data to. */
IN gctUINT32 address;
/* Data to write. */
IN gctUINT32 data;
}
WriteData;
/* gcvHAL_ALLOCATE_CONTIGUOUS_MEMORY */
struct _gcsHAL_ALLOCATE_CONTIGUOUS_MEMORY
{
/* Number of bytes to allocate. */
IN OUT gctSIZE_T bytes;
/* Physical address of allocation. */
OUT gctPHYS_ADDR physical;
/* Logical address of allocation. */
OUT gctPOINTER logical;
}
AllocateContiguousMemory;
/* gcvHAL_FREE_CONTIGUOUS_MEMORY */
struct _gcsHAL_FREE_CONTIGUOUS_MEMORY
{
/* Number of bytes allocated. */
IN gctSIZE_T bytes;
/* Physical address of allocation. */
IN gctPHYS_ADDR physical;
/* Logical address of allocation. */
IN gctPOINTER logical;
}
FreeContiguousMemory;
/* gcvHAL_READ_REGISTER */
struct _gcsHAL_READ_REGISTER
{
/* Logical address of memory to write data to. */
IN gctUINT32 address;
/* Data read. */
OUT gctUINT32 data;
}
ReadRegisterData;
/* gcvHAL_WRITE_REGISTER */
struct _gcsHAL_WRITE_REGISTER
{
/* Logical address of memory to write data to. */
IN gctUINT32 address;
/* Data read. */
IN gctUINT32 data;
}
WriteRegisterData;
/* gcvHAL_GET_PROFILE_SETTING */
struct _gcsHAL_GET_PROFILE_SETTING
{
/* Enable profiling */
OUT gctBOOL enable;
/* The profile file name */
OUT gctCHAR fileName[gcdMAX_PROFILE_FILE_NAME];
}
GetProfileSetting;
/* gcvHAL_SET_PROFILE_SETTING */
struct _gcsHAL_SET_PROFILE_SETTING
{
/* Enable profiling */
IN gctBOOL enable;
/* The profile file name */
IN gctCHAR fileName[gcdMAX_PROFILE_FILE_NAME];
}
SetProfileSetting;
/* gcvHAL_READ_ALL_PROFILE_REGISTERS */
struct _gcsHAL_READ_ALL_PROFILE_REGISTERS
{
/* Data read. */
OUT gcsPROFILER_COUNTERS counters;
}
RegisterProfileData;
/* gcvHAL_PROFILE_REGISTERS_2D */
struct _gcsHAL_PROFILE_REGISTERS_2D
{
/* Data read. */
OUT gcs2D_PROFILE_PTR hwProfile2D;
}
RegisterProfileData2D;
/* Power management. */
/* gcvHAL_SET_POWER_MANAGEMENT_STATE */
struct _gcsHAL_SET_POWER_MANAGEMENT
{
/* Data read. */
IN gceCHIPPOWERSTATE state;
}
SetPowerManagement;
/* gcvHAL_QUERY_POWER_MANAGEMENT_STATE */
struct _gcsHAL_QUERY_POWER_MANAGEMENT
{
/* Data read. */
OUT gceCHIPPOWERSTATE state;
/* Idle query. */
OUT gctBOOL isIdle;
}
QueryPowerManagement;
/* gcvHAL_QUERY_KERNEL_SETTINGS */
struct _gcsHAL_QUERY_KERNEL_SETTINGS
{
/* Settings.*/
OUT gcsKERNEL_SETTINGS settings;
}
QueryKernelSettings;
/* gcvHAL_MAP_PHYSICAL */
struct _gcsHAL_MAP_PHYSICAL
{
/* gcvTRUE to map, gcvFALSE to unmap. */
IN gctBOOL map;
/* Physical address. */
IN OUT gctPHYS_ADDR physical;
}
MapPhysical;
/* gcvHAL_DEBUG */
struct _gcsHAL_DEBUG
{
/* If gcvTRUE, set the debug information. */
IN gctBOOL set;
IN gctUINT32 level;
IN gctUINT32 zones;
IN gctBOOL enable;
/* Message to print if not empty. */
IN gctCHAR message[80];
}
Debug;
struct _gcsHAL_CACHE
{
IN gctBOOL invalidate;
IN gctHANDLE process;
IN gctPOINTER logical;
IN gctSIZE_T bytes;
}
Cache;
}
u;
}
gcsHAL_INTERFACE;
#ifdef __cplusplus
}
#endif
#endif /* __gc_hal_driver_h_ */

View File

@ -1,90 +0,0 @@
/****************************************************************************
*
* Copyright (C) 2005 - 2010 by Vivante Corp.
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*****************************************************************************/
#ifndef __gc_hal_dump_h_
#define __gc_hal_dump_h_
#ifdef __cplusplus
extern "C" {
#endif
/*
** FILE LAYOUT:
**
** gcsDUMP_FILE structure
**
** gcsDUMP_DATA frame
** gcsDUMP_DATA or gcDUMP_DATA_SIZE records rendingring the frame
** gctUINT8 data[length]
*/
#define gcvDUMP_FILE_SIGNATURE gcmCC('g','c','D','B')
typedef struct _gcsDUMP_FILE
{
gctUINT32 signature; /* File signature */
gctSIZE_T length; /* Length of file */
gctUINT32 frames; /* Number of frames in file */
}
gcsDUMP_FILE;
typedef enum _gceDUMP_TAG
{
gcvTAG_SURFACE = gcmCC('s','u','r','f'),
gcvTAG_FRAME = gcmCC('f','r','m',' '),
gcvTAG_COMMAND = gcmCC('c','m','d',' '),
gcvTAG_INDEX = gcmCC('i','n','d','x'),
gcvTAG_STREAM = gcmCC('s','t','r','m'),
gcvTAG_TEXTURE = gcmCC('t','e','x','t'),
gcvTAG_RENDER_TARGET = gcmCC('r','n','d','r'),
gcvTAG_DEPTH = gcmCC('z','b','u','f'),
gcvTAG_RESOLVE = gcmCC('r','s','l','v'),
gcvTAG_DELETE = gcmCC('d','e','l',' '),
}
gceDUMP_TAG;
typedef struct _gcsDUMP_SURFACE
{
gceDUMP_TAG type; /* Type of record. */
gctUINT32 address; /* Address of the surface. */
gctINT16 width; /* Width of surface. */
gctINT16 height; /* Height of surface. */
gceSURF_FORMAT format; /* Surface pixel format. */
gctSIZE_T length; /* Number of bytes inside the surface. */
}
gcsDUMP_SURFACE;
typedef struct _gcsDUMP_DATA
{
gceDUMP_TAG type; /* Type of record. */
gctSIZE_T length; /* Number of bytes of data. */
gctUINT32 address; /* Address for the data. */
}
gcsDUMP_DATA;
#ifdef __cplusplus
}
#endif
#endif /* __gc_hal_dump_h_ */

File diff suppressed because it is too large Load Diff

View File

@ -1,560 +0,0 @@
/****************************************************************************
*
* Copyright (C) 2005 - 2010 by Vivante Corp.
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*****************************************************************************/
#ifndef __gc_hal_enum_h_
#define __gc_hal_enum_h_
#ifdef __cplusplus
extern "C" {
#endif
/* Chip models. */
typedef enum _gceCHIPMODEL
{
gcv300 = 0x0300,
gcv400 = 0x0400,
gcv410 = 0x0410,
gcv450 = 0x0450,
gcv500 = 0x0500,
gcv530 = 0x0530,
gcv600 = 0x0600,
gcv700 = 0x0700,
gcv800 = 0x0800,
gcv860 = 0x0860,
gcv1000 = 0x1000,
}
gceCHIPMODEL;
/* Chip features. */
typedef enum _gceFEATURE
{
gcvFEATURE_PIPE_2D,
gcvFEATURE_PIPE_3D,
gcvFEATURE_PIPE_VG,
gcvFEATURE_DC,
gcvFEATURE_HIGH_DYNAMIC_RANGE,
gcvFEATURE_MODULE_CG,
gcvFEATURE_MIN_AREA,
gcvFEATURE_BUFFER_INTERLEAVING,
gcvFEATURE_BYTE_WRITE_2D,
gcvFEATURE_ENDIANNESS_CONFIG,
gcvFEATURE_DUAL_RETURN_BUS,
gcvFEATURE_DEBUG_MODE,
gcvFEATURE_YUY2_RENDER_TARGET,
gcvFEATURE_FRAGMENT_PROCESSOR,
gcvFEATURE_2DPE20,
gcvFEATURE_FAST_CLEAR,
gcvFEATURE_YUV420_TILER,
gcvFEATURE_YUY2_AVERAGING,
gcvFEATURE_FLIP_Y,
gcvFEATURE_EARLY_Z,
gcvFEATURE_Z_COMPRESSION,
gcvFEATURE_MSAA,
gcvFEATURE_SPECIAL_ANTI_ALIASING,
gcvFEATURE_SPECIAL_MSAA_LOD,
gcvFEATURE_422_TEXTURE_COMPRESSION,
gcvFEATURE_DXT_TEXTURE_COMPRESSION,
gcvFEATURE_ETC1_TEXTURE_COMPRESSION,
gcvFEATURE_CORRECT_TEXTURE_CONVERTER,
gcvFEATURE_TEXTURE_8K,
gcvFEATURE_SCALER,
gcvFEATURE_YUV420_SCALER,
gcvFEATURE_SHADER_HAS_W,
gcvFEATURE_SHADER_HAS_SIGN,
gcvFEATURE_SHADER_HAS_FLOOR,
gcvFEATURE_SHADER_HAS_CEIL,
gcvFEATURE_SHADER_HAS_SQRT,
gcvFEATURE_SHADER_HAS_TRIG,
gcvFEATURE_VAA,
gcvFEATURE_HZ,
gcvFEATURE_CORRECT_STENCIL,
gcvFEATURE_VG20,
gcvFEATURE_VG_FILTER,
gcvFEATURE_VG21,
gcvFEATURE_VG_DOUBLE_BUFFER,
gcvFEATURE_MC20,
gcvFEATURE_SUPER_TILED,
}
gceFEATURE;
/* Chip Power Status. */
typedef enum _gceCHIPPOWERSTATE
{
gcvPOWER_ON,
gcvPOWER_OFF,
gcvPOWER_IDLE,
gcvPOWER_SUSPEND,
gcvPOWER_SUSPEND_ATPOWERON,
gcvPOWER_OFF_ATPOWERON,
gcvPOWER_IDLE_BROADCAST,
gcvPOWER_SUSPEND_BROADCAST,
gcvPOWER_OFF_BROADCAST,
gcvPOWER_OFF_RECOVERY,
}
gceCHIPPOWERSTATE;
/* CPU cache operations */
typedef enum _gceCACHEOPERATION
{
gcvCACHE_CLEAN = 0x01,
gcvCACHE_INVALIDATE = 0x02,
gcvCACHE_FLUSH = gcvCACHE_CLEAN | gcvCACHE_INVALIDATE,
gcvCACHE_MEMORY_BARRIER = 0x04
}
gceCACHEOPERATION;
/* Surface types. */
typedef enum _gceSURF_TYPE
{
gcvSURF_TYPE_UNKNOWN,
gcvSURF_INDEX,
gcvSURF_VERTEX,
gcvSURF_TEXTURE,
gcvSURF_RENDER_TARGET,
gcvSURF_DEPTH,
gcvSURF_BITMAP,
gcvSURF_TILE_STATUS,
gcvSURF_MASK,
gcvSURF_SCISSOR,
gcvSURF_HIERARCHICAL_DEPTH,
gcvSURF_NUM_TYPES, /* Make sure this is the last one! */
/* Combinations. */
gcvSURF_NO_TILE_STATUS = 0x100,
gcvSURF_RENDER_TARGET_NO_TILE_STATUS = gcvSURF_RENDER_TARGET
| gcvSURF_NO_TILE_STATUS,
gcvSURF_DEPTH_NO_TILE_STATUS = gcvSURF_DEPTH
| gcvSURF_NO_TILE_STATUS,
}
gceSURF_TYPE;
typedef enum _gceSURF_COLOR_TYPE
{
gcvSURF_COLOR_UNKNOWN,
gcvSURF_COLOR_LINEAR = 0x01,
gcvSURF_COLOR_ALPHA_PRE = 0x02,
}
gceSURF_COLOR_TYPE;
/* Rotation. */
typedef enum _gceSURF_ROTATION
{
gcvSURF_0_DEGREE,
gcvSURF_90_DEGREE,
gcvSURF_180_DEGREE,
gcvSURF_270_DEGREE
}
gceSURF_ROTATION;
/* Surface formats. */
typedef enum _gceSURF_FORMAT
{
/* Unknown format. */
gcvSURF_UNKNOWN,
/* Palettized formats. */
gcvSURF_INDEX1 = 100,
gcvSURF_INDEX4,
gcvSURF_INDEX8,
/* RGB formats. */
gcvSURF_A2R2G2B2 = 200,
gcvSURF_R3G3B2,
gcvSURF_A8R3G3B2,
gcvSURF_X4R4G4B4,
gcvSURF_A4R4G4B4,
gcvSURF_R4G4B4A4,
gcvSURF_X1R5G5B5,
gcvSURF_A1R5G5B5,
gcvSURF_R5G5B5A1,
gcvSURF_R5G6B5,
gcvSURF_R8G8B8,
gcvSURF_X8R8G8B8,
gcvSURF_A8R8G8B8,
gcvSURF_R8G8B8A8,
gcvSURF_G8R8G8B8,
gcvSURF_R8G8B8G8,
gcvSURF_X2R10G10B10,
gcvSURF_A2R10G10B10,
gcvSURF_X12R12G12B12,
gcvSURF_A12R12G12B12,
gcvSURF_X16R16G16B16,
gcvSURF_A16R16G16B16,
gcvSURF_R8G8B8X8,
gcvSURF_R5G5B5X1,
gcvSURF_R4G4B4X4,
/* BGR formats. */
gcvSURF_A4B4G4R4 = 300,
gcvSURF_A1B5G5R5,
gcvSURF_B5G6R5,
gcvSURF_B8G8R8,
gcvSURF_X8B8G8R8,
gcvSURF_A8B8G8R8,
gcvSURF_A2B10G10R10,
gcvSURF_A16B16G16R16,
gcvSURF_G16R16,
gcvSURF_B4G4R4A4,
gcvSURF_B5G5R5A1,
gcvSURF_B8G8R8X8,
gcvSURF_B8G8R8A8,
gcvSURF_X4B4G4R4,
gcvSURF_X1B5G5R5,
gcvSURF_B4G4R4X4,
gcvSURF_B5G5R5X1,
/* Compressed formats. */
gcvSURF_DXT1 = 400,
gcvSURF_DXT2,
gcvSURF_DXT3,
gcvSURF_DXT4,
gcvSURF_DXT5,
gcvSURF_CXV8U8,
gcvSURF_ETC1,
/* YUV formats. */
gcvSURF_YUY2 = 500,
gcvSURF_UYVY,
gcvSURF_YV12,
gcvSURF_I420,
gcvSURF_NV12,
gcvSURF_NV21,
gcvSURF_NV16,
gcvSURF_NV61,
gcvSURF_YVYU,
gcvSURF_VYUY,
/* Depth formats. */
gcvSURF_D16 = 600,
gcvSURF_D24S8,
gcvSURF_D32,
gcvSURF_D24X8,
/* Alpha formats. */
gcvSURF_A4 = 700,
gcvSURF_A8,
gcvSURF_A12,
gcvSURF_A16,
gcvSURF_A32,
gcvSURF_A1,
/* Luminance formats. */
gcvSURF_L4 = 800,
gcvSURF_L8,
gcvSURF_L12,
gcvSURF_L16,
gcvSURF_L32,
gcvSURF_L1,
/* Alpha/Luminance formats. */
gcvSURF_A4L4 = 900,
gcvSURF_A2L6,
gcvSURF_A8L8,
gcvSURF_A4L12,
gcvSURF_A12L12,
gcvSURF_A16L16,
/* Bump formats. */
gcvSURF_L6V5U5 = 1000,
gcvSURF_V8U8,
gcvSURF_X8L8V8U8,
gcvSURF_Q8W8V8U8,
gcvSURF_A2W10V10U10,
gcvSURF_V16U16,
gcvSURF_Q16W16V16U16,
/* Floating point formats. */
gcvSURF_R16F = 1100,
gcvSURF_G16R16F,
gcvSURF_A16B16G16R16F,
gcvSURF_R32F,
gcvSURF_G32R32F,
gcvSURF_A32B32G32R32F,
#if 0
/* FIXME: remove HDR support for now. */
/* HDR formats. */
gcvSURF_HDR7E3 = 1200,
gcvSURF_HDR6E4,
gcvSURF_HDR5E5,
gcvSURF_HDR6E5,
#endif
}
gceSURF_FORMAT;
/* Pixel swizzle modes. */
typedef enum _gceSURF_SWIZZLE
{
gcvSURF_NOSWIZZLE,
gcvSURF_ARGB,
gcvSURF_ABGR,
gcvSURF_RGBA,
gcvSURF_BGRA
}
gceSURF_SWIZZLE;
/* Transparency modes. */
typedef enum _gceSURF_TRANSPARENCY
{
/* Valid only for PE 1.0 */
gcvSURF_OPAQUE,
gcvSURF_SOURCE_MATCH,
gcvSURF_SOURCE_MASK,
gcvSURF_PATTERN_MASK,
}
gceSURF_TRANSPARENCY;
/* Transparency modes. */
typedef enum _gce2D_TRANSPARENCY
{
/* Valid only for PE 2.0 */
gcv2D_OPAQUE,
gcv2D_KEYED,
gcv2D_MASKED
}
gce2D_TRANSPARENCY;
/* Mono packing modes. */
typedef enum _gceSURF_MONOPACK
{
gcvSURF_PACKED8,
gcvSURF_PACKED16,
gcvSURF_PACKED32,
gcvSURF_UNPACKED,
}
gceSURF_MONOPACK;
/* Blending modes. */
typedef enum _gceSURF_BLEND_MODE
{
/* Porter-Duff blending modes. */
/* Fsrc Fdst */
gcvBLEND_CLEAR, /* 0 0 */
gcvBLEND_SRC, /* 1 0 */
gcvBLEND_DST, /* 0 1 */
gcvBLEND_SRC_OVER_DST, /* 1 1 - Asrc */
gcvBLEND_DST_OVER_SRC, /* 1 - Adst 1 */
gcvBLEND_SRC_IN_DST, /* Adst 0 */
gcvBLEND_DST_IN_SRC, /* 0 Asrc */
gcvBLEND_SRC_OUT_DST, /* 1 - Adst 0 */
gcvBLEND_DST_OUT_SRC, /* 0 1 - Asrc */
gcvBLEND_SRC_ATOP_DST, /* Adst 1 - Asrc */
gcvBLEND_DST_ATOP_SRC, /* 1 - Adst Asrc */
gcvBLEND_SRC_XOR_DST, /* 1 - Adst 1 - Asrc */
/* Special blending modes. */
gcvBLEND_SET, /* DST = 1 */
gcvBLEND_SUB /* DST = DST * (1 - SRC) */
}
gceSURF_BLEND_MODE;
/* Per-pixel alpha modes. */
typedef enum _gceSURF_PIXEL_ALPHA_MODE
{
gcvSURF_PIXEL_ALPHA_STRAIGHT,
gcvSURF_PIXEL_ALPHA_INVERSED
}
gceSURF_PIXEL_ALPHA_MODE;
/* Global alpha modes. */
typedef enum _gceSURF_GLOBAL_ALPHA_MODE
{
gcvSURF_GLOBAL_ALPHA_OFF,
gcvSURF_GLOBAL_ALPHA_ON,
gcvSURF_GLOBAL_ALPHA_SCALE
}
gceSURF_GLOBAL_ALPHA_MODE;
/* Color component modes for alpha blending. */
typedef enum _gceSURF_PIXEL_COLOR_MODE
{
gcvSURF_COLOR_STRAIGHT,
gcvSURF_COLOR_MULTIPLY
}
gceSURF_PIXEL_COLOR_MODE;
/* Color component modes for alpha blending. */
typedef enum _gce2D_PIXEL_COLOR_MULTIPLY_MODE
{
gcv2D_COLOR_MULTIPLY_DISABLE,
gcv2D_COLOR_MULTIPLY_ENABLE
}
gce2D_PIXEL_COLOR_MULTIPLY_MODE;
/* Color component modes for alpha blending. */
typedef enum _gce2D_GLOBAL_COLOR_MULTIPLY_MODE
{
gcv2D_GLOBAL_COLOR_MULTIPLY_DISABLE,
gcv2D_GLOBAL_COLOR_MULTIPLY_ALPHA,
gcv2D_GLOBAL_COLOR_MULTIPLY_COLOR
}
gce2D_GLOBAL_COLOR_MULTIPLY_MODE;
/* Alpha blending factor modes. */
typedef enum _gceSURF_BLEND_FACTOR_MODE
{
gcvSURF_BLEND_ZERO,
gcvSURF_BLEND_ONE,
gcvSURF_BLEND_STRAIGHT,
gcvSURF_BLEND_INVERSED,
gcvSURF_BLEND_COLOR,
gcvSURF_BLEND_COLOR_INVERSED,
gcvSURF_BLEND_SRC_ALPHA_SATURATED
}
gceSURF_BLEND_FACTOR_MODE;
/* Alpha blending porter duff rules. */
typedef enum _gce2D_PORTER_DUFF_RULE
{
gcvPD_CLEAR,
gcvPD_SRC,
gcvPD_SRC_OVER,
gcvPD_DST_OVER,
gcvPD_SRC_IN,
gcvPD_DST_IN,
gcvPD_SRC_OUT,
gcvPD_DST_OUT,
gcvPD_SRC_ATOP,
gcvPD_DST_ATOP,
gcvPD_ADD,
gcvPD_XOR,
gcvPD_DST
}
gce2D_PORTER_DUFF_RULE;
/* Alpha blending factor modes. */
typedef enum _gce2D_YUV_COLOR_MODE
{
gcv2D_YUV_601,
gcv2D_YUV_709
}
gce2D_YUV_COLOR_MODE;
/* 2D Rotation and flipping. */
typedef enum _gce2D_ORIENTATION
{
gcv2D_0_DEGREE,
gcv2D_90_DEGREE,
gcv2D_180_DEGREE,
gcv2D_270_DEGREE,
gcv2D_X_FLIP,
gcv2D_Y_FLIP
}
gce2D_ORIENTATION;
typedef enum _gce2D_COMMAND
{
gcv2D_CLEAR,
gcv2D_LINE,
gcv2D_BLT,
gcv2D_STRETCH,
gcv2D_HOR_FILTER,
gcv2D_VER_FILTER,
}
gce2D_COMMAND;
/* Texture functions. */
typedef enum _gceTEXTURE_FUNCTION
{
gcvTEXTURE_DUMMY = 0,
gcvTEXTURE_REPLACE = 0,
gcvTEXTURE_MODULATE,
gcvTEXTURE_ADD,
gcvTEXTURE_ADD_SIGNED,
gcvTEXTURE_INTERPOLATE,
gcvTEXTURE_SUBTRACT,
gcvTEXTURE_DOT3
}
gceTEXTURE_FUNCTION;
/* Texture sources. */
typedef enum _gceTEXTURE_SOURCE
{
gcvCOLOR_FROM_TEXTURE,
gcvCOLOR_FROM_CONSTANT_COLOR,
gcvCOLOR_FROM_PRIMARY_COLOR,
gcvCOLOR_FROM_PREVIOUS_COLOR
}
gceTEXTURE_SOURCE;
/* Texture source channels. */
typedef enum _gceTEXTURE_CHANNEL
{
gcvFROM_COLOR,
gcvFROM_ONE_MINUS_COLOR,
gcvFROM_ALPHA,
gcvFROM_ONE_MINUS_ALPHA
}
gceTEXTURE_CHANNEL;
/* Filter types. */
typedef enum _gceFILTER_TYPE
{
gcvFILTER_SYNC,
gcvFILTER_BLUR,
gcvFILTER_USER
}
gceFILTER_TYPE;
/* Filter pass types. */
typedef enum _gceFILTER_PASS_TYPE
{
gcvFILTER_HOR_PASS,
gcvFILTER_VER_PASS
}
gceFILTER_PASS_TYPE;
/* Endian hints. */
typedef enum _gceENDIAN_HINT
{
gcvENDIAN_NO_SWAP = 0,
gcvENDIAN_SWAP_WORD,
gcvENDIAN_SWAP_DWORD
}
gceENDIAN_HINT;
/* Endian hints. */
typedef enum _gceTILING
{
gcvLINEAR,
gcvTILED,
gcvSUPERTILED
}
gceTILING;
/******************************************************************************\
****************************** Object Declarations *****************************
\******************************************************************************/
typedef struct _gcoCONTEXT * gcoCONTEXT;
typedef struct _gcoCMDBUF * gcoCMDBUF;
typedef struct _gcoQUEUE * gcoQUEUE;
typedef struct _gcsHAL_INTERFACE * gcsHAL_INTERFACE_PTR;
typedef struct gcs2D_PROFILE * gcs2D_PROFILE_PTR;
#ifdef __cplusplus
}
#endif
#endif /* __gc_hal_enum_h_ */

View File

@ -1,471 +0,0 @@
/****************************************************************************
*
* Copyright (C) 2005 - 2010 by Vivante Corp.
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*****************************************************************************/
/*
** Include file for the local memory management.
*/
#ifndef __gc_hal_mem_h_
#define __gc_hal_mem_h_
#ifdef __cplusplus
extern "C" {
#endif
/*******************************************************************************
** Usage:
The macros to declare MemPool type and functions are
gcmMEM_DeclareFSMemPool (Type, TypeName, Prefix)
gcmMEM_DeclareVSMemPool (Type, TypeName, Prefix)
gcmMEM_DeclareAFSMemPool(Type, TypeName, Prefix)
The data structures for MemPool are
typedef struct _gcsMEM_FS_MEM_POOL * gcsMEM_FS_MEM_POOL;
typedef struct _gcsMEM_VS_MEM_POOL * gcsMEM_VS_MEM_POOL;
typedef struct _gcsMEM_AFS_MEM_POOL * gcsMEM_AFS_MEM_POOL;
The MemPool constructor and destructor functions are
gcfMEM_InitFSMemPool(gcsMEM_FS_MEM_POOL *, gcoOS, gctUINT, gctUINT);
gcfMEM_FreeFSMemPool(gcsMEM_FS_MEM_POOL *);
gcfMEM_InitVSMemPool(gcsMEM_VS_MEM_POOL *, gcoOS, gctUINT, gctBOOL);
gcfMEM_FreeVSMemPool(gcsMEM_VS_MEM_POOL *);
gcfMEM_InitAFSMemPool(gcsMEM_AFS_MEM_POOL *, gcoOS, gctUINT);
gcfMEM_FreeAFSMemPool(gcsMEM_AFS_MEM_POOL *);
FS: for Fixed-Size data structures
VS: for Variable-size data structures
AFS: for Array of Fixed-Size data structures
// Example 1: For a fixed-size data structure, struct gcsNode.
// It is used locally in a file, so the functions are static without prefix.
// At top level, declear allocate and free functions.
// The first argument is the data type.
// The second armument is the short name used in the fuctions.
gcmMEM_DeclareFSMemPool(struct gcsNode, Node, );
// The previous macro creates two inline functions,
// _AllocateNode and _FreeNode.
// In function or struct
gcsMEM_FS_MEM_POOL nodeMemPool;
// In function,
struct gcsNode * node;
gceSTATUS status;
// Before using the memory pool, initialize it.
// The second argument is the gcoOS object.
// The third argument is the number of data structures to allocate for each chunk.
status = gcfMEM_InitFSMemPool(&nodeMemPool, os, 100, sizeof(struct gcsNode));
...
// Allocate a node.
status = _AllocateNode(nodeMemPool, &node);
...
// Free a node.
_FreeNode(nodeMemPool, node);
// After using the memory pool, free it.
gcfMEM_FreeFSMemPool(&nodeMemPool);
// Example 2: For array of fixed-size data structures, struct gcsNode.
// It is used in several files, so the functions are extern with prefix.
// At top level, declear allocate and free functions.
// The first argument is the data type, and the second one is the short name
// used in the fuctions.
gcmMEM_DeclareAFSMemPool(struct gcsNode, NodeArray, gcfOpt);
// The previous macro creates two inline functions,
// gcfOpt_AllocateNodeArray and gcfOpt_FreeNodeArray.
// In function or struct
gcsMEM_AFS_MEM_POOL nodeArrayMemPool;
// In function,
struct gcsNode * nodeArray;
gceSTATUS status;
// Before using the array memory pool, initialize it.
// The second argument is the gcoOS object, the third is the number of data
// structures to allocate for each chunk.
status = gcfMEM_InitAFSMemPool(&nodeArrayMemPool, os, sizeof(struct gcsNode));
...
// Allocate a node array of size 100.
status = gcfOpt_AllocateNodeArray(nodeArrayMemPool, &nodeArray, 100);
...
// Free a node array.
gcfOpt_FreeNodeArray(&nodeArrayMemPool, nodeArray);
// After using the array memory pool, free it.
gcfMEM_FreeAFSMemPool(&nodeArrayMemPool);
*******************************************************************************/
/*******************************************************************************
** To switch back to use gcoOS_Allocate and gcoOS_Free, add
** #define USE_LOCAL_MEMORY_POOL 0
** before including this file.
*******************************************************************************/
#ifndef USE_LOCAL_MEMORY_POOL
/*
USE_LOCAL_MEMORY_POOL
This define enables the local memory management to improve performance.
*/
#define USE_LOCAL_MEMORY_POOL 1
#endif
/*******************************************************************************
** Memory Pool Data Structures
*******************************************************************************/
#if USE_LOCAL_MEMORY_POOL
typedef struct _gcsMEM_FS_MEM_POOL * gcsMEM_FS_MEM_POOL;
typedef struct _gcsMEM_VS_MEM_POOL * gcsMEM_VS_MEM_POOL;
typedef struct _gcsMEM_AFS_MEM_POOL * gcsMEM_AFS_MEM_POOL;
#else
typedef gcoOS gcsMEM_FS_MEM_POOL;
typedef gcoOS gcsMEM_VS_MEM_POOL;
typedef gcoOS gcsMEM_AFS_MEM_POOL;
#endif
/*******************************************************************************
** Memory Pool Macros
*******************************************************************************/
#if USE_LOCAL_MEMORY_POOL
#define gcmMEM_DeclareFSMemPool(Type, TypeName, Prefix) \
gceSTATUS \
Prefix##_Allocate##TypeName( \
gcsMEM_FS_MEM_POOL MemPool, \
Type ** Pointer \
) \
{ \
return(gcfMEM_FSMemPoolGetANode(MemPool, (gctPOINTER *) Pointer)); \
} \
\
gceSTATUS \
Prefix##_CAllocate##TypeName( \
gcsMEM_FS_MEM_POOL MemPool, \
Type ** Pointer \
) \
{ \
gceSTATUS status; \
gcmERR_RETURN(gcfMEM_FSMemPoolGetANode(MemPool, (gctPOINTER *) Pointer)); \
gcmVERIFY_OK(gcoOS_ZeroMemory(*(gctPOINTER *) Pointer, gcmSIZEOF(Type))); \
return gcvSTATUS_OK; \
} \
\
gceSTATUS \
Prefix##_Free##TypeName( \
gcsMEM_FS_MEM_POOL MemPool, \
Type * Pointer \
) \
{ \
return(gcfMEM_FSMemPoolFreeANode(MemPool, (gctPOINTER) Pointer)); \
} \
\
gceSTATUS \
Prefix##_Free##TypeName##List( \
gcsMEM_FS_MEM_POOL MemPool, \
Type * FirstPointer, \
Type * LastPointer \
) \
{ \
return(gcfMEM_FSMemPoolFreeAList(MemPool, (gctPOINTER) FirstPointer, (gctPOINTER) LastPointer)); \
}
#define gcmMEM_DeclareVSMemPool(Type, TypeName, Prefix) \
gceSTATUS \
Prefix##_Allocate##TypeName( \
gcsMEM_FS_MEM_POOL MemPool, \
Type ** Pointer, \
gctUINT Size \
) \
{ \
return(gcfMEM_VSMemPoolGetANode(MemPool, Size, (gctPOINTER *) Pointer)); \
} \
\
gceSTATUS \
Prefix##_CAllocate##TypeName( \
gcsMEM_FS_MEM_POOL MemPool, \
Type ** Pointer, \
gctUINT Size \
) \
{ \
gceSTATUS status; \
gcmERR_RETURN(gcfMEM_VSMemPoolGetANode(MemPool, Size, (gctPOINTER *) Pointer)); \
gcmVERIFY_OK(gcoOS_ZeroMemory(*(gctPOINTER *) Pointer, size)); \
return gcvSTATUS_OK; \
} \
\
gceSTATUS \
Prefix##_Free##TypeName( \
gcsMEM_FS_MEM_POOL MemPool, \
Type * Pointer \
) \
{ \
return(gcfMEM_VSMemPoolFreeANode(MemPool, (gctPOINTER) Pointer)); \
}
#define gcmMEM_DeclareAFSMemPool(Type, TypeName, Prefix) \
gceSTATUS \
Prefix##_Allocate##TypeName( \
gcsMEM_AFS_MEM_POOL MemPool, \
Type ** Pointer, \
gctUINT Count \
) \
{ \
return(gcfMEM_AFSMemPoolGetANode(MemPool, Count, (gctPOINTER *) Pointer)); \
} \
\
gceSTATUS \
Prefix##_CAllocate##TypeName( \
gcsMEM_AFS_MEM_POOL MemPool, \
Type ** Pointer, \
gctUINT Count \
) \
{ \
gceSTATUS status; \
gcmERR_RETURN(gcfMEM_AFSMemPoolGetANode(MemPool, Count, (gctPOINTER *) Pointer)); \
gcmVERIFY_OK(gcoOS_ZeroMemory(*(gctPOINTER *) Pointer, Count * gcmSIZEOF(Type))); \
return gcvSTATUS_OK; \
} \
\
gceSTATUS \
Prefix##_Free##TypeName( \
gcsMEM_AFS_MEM_POOL MemPool, \
Type * Pointer \
) \
{ \
return(gcfMEM_AFSMemPoolFreeANode(MemPool, (gctPOINTER) Pointer)); \
}
#else
#define gcmMEM_DeclareFSMemPool(Type, TypeName, Prefix) \
gceSTATUS \
Prefix##_Allocate##TypeName( \
gcsMEM_FS_MEM_POOL MemPool, \
Type ** Pointer \
) \
{ \
return(gcoOS_Allocate(MemPool, \
gcmSIZEOF(Type), \
(gctPOINTER *) Pointer)); \
} \
\
gceSTATUS \
Prefix##_CAllocate##TypeName( \
gcsMEM_FS_MEM_POOL MemPool, \
Type ** Pointer \
) \
{ \
gceSTATUS status; \
gcmERR_RETURN(gcoOS_Allocate(MemPool, \
gcmSIZEOF(Type), \
(gctPOINTER *) Pointer)); \
gcmVERIFY_OK(gcoOS_ZeroMemory(*(gctPOINTER *) Pointer, gcmSIZEOF(Type))); \
return gcvSTATUS_OK; \
} \
\
gceSTATUS \
Prefix##_Free##TypeName( \
gcsMEM_FS_MEM_POOL MemPool, \
Type * Pointer \
) \
{ \
return(gcoOS_Free(MemPool, Pointer)); \
}
#define gcmMEM_DeclareVSMemPool(Type, TypeName, Prefix) \
gceSTATUS \
Prefix##_Allocate##TypeName( \
gcsMEM_VS_MEM_POOL MemPool, \
Type ** Pointer, \
gctUINT Size \
) \
{ \
return(gcoOS_Allocate(MemPool, \
Size, \
(gctPOINTER *) Pointer)); \
} \
\
gceSTATUS \
Prefix##_CAllocate##TypeName( \
gcsMEM_VS_MEM_POOL MemPool, \
Type ** Pointer, \
gctUINT Size \
) \
{ \
gceSTATUS status; \
gcmERR_RETURN(gcoOS_Allocate(MemPool, \
Size, \
(gctPOINTER *) Pointer)); \
gcmVERIFY_OK(gcoOS_ZeroMemory(*(gctPOINTER *) Pointer, Size)); \
return gcvSTATUS_OK; \
} \
\
gceSTATUS \
Prefix##_Free##TypeName( \
gcsMEM_VS_MEM_POOL MemPool, \
Type * Pointer \
) \
{ \
return(gcoOS_Free(MemPool, Pointer)); \
}
#define gcmMEM_DeclareAFSMemPool(Type, TypeName, Prefix) \
gceSTATUS \
Prefix##_Allocate##TypeName( \
gcsMEM_AFS_MEM_POOL MemPool, \
Type ** Pointer, \
gctUINT Count \
) \
{ \
return(gcoOS_Allocate(MemPool, \
Count * gcmSIZEOF(Type), \
(gctPOINTER *) Pointer)); \
} \
\
gceSTATUS \
Prefix##_CAllocate##TypeName( \
gcsMEM_AFS_MEM_POOL MemPool, \
Type ** Pointer, \
gctUINT Count \
) \
{ \
gceSTATUS status; \
gcmERR_RETURN(gcoOS_Allocate(MemPool, \
Count * gcmSIZEOF(Type), \
(gctPOINTER *) Pointer)); \
gcmVERIFY_OK(gcoOS_ZeroMemory(*(gctPOINTER *) Pointer, Count * gcmSIZEOF(Type))); \
return gcvSTATUS_OK; \
} \
\
gceSTATUS \
Prefix##_Free##TypeName( \
gcsMEM_AFS_MEM_POOL MemPool, \
Type * Pointer \
) \
{ \
return(gcoOS_Free(MemPool, Pointer)); \
}
#endif
/*******************************************************************************
** Memory Pool Data Functions
*******************************************************************************/
gceSTATUS
gcfMEM_InitFSMemPool(
IN gcsMEM_FS_MEM_POOL * MemPool,
IN gcoOS OS,
IN gctUINT NodeCount,
IN gctUINT NodeSize
);
gceSTATUS
gcfMEM_FreeFSMemPool(
IN gcsMEM_FS_MEM_POOL * MemPool
);
gceSTATUS
gcfMEM_FSMemPoolGetANode(
IN gcsMEM_FS_MEM_POOL MemPool,
OUT gctPOINTER * Node
);
gceSTATUS
gcfMEM_FSMemPoolFreeANode(
IN gcsMEM_FS_MEM_POOL MemPool,
IN gctPOINTER Node
);
gceSTATUS
gcfMEM_FSMemPoolFreeAList(
IN gcsMEM_FS_MEM_POOL MemPool,
IN gctPOINTER FirstNode,
IN gctPOINTER LastNode
);
gceSTATUS
gcfMEM_InitVSMemPool(
IN gcsMEM_VS_MEM_POOL * MemPool,
IN gcoOS OS,
IN gctUINT BlockSize,
IN gctBOOL RecycleFreeNode
);
gceSTATUS
gcfMEM_FreeVSMemPool(
IN gcsMEM_VS_MEM_POOL * MemPool
);
gceSTATUS
gcfMEM_VSMemPoolGetANode(
IN gcsMEM_VS_MEM_POOL MemPool,
IN gctUINT Size,
IN gctUINT Alignment,
OUT gctPOINTER * Node
);
gceSTATUS
gcfMEM_VSMemPoolFreeANode(
IN gcsMEM_VS_MEM_POOL MemPool,
IN gctPOINTER Node
);
gceSTATUS
gcfMEM_InitAFSMemPool(
IN gcsMEM_AFS_MEM_POOL *MemPool,
IN gcoOS OS,
IN gctUINT NodeCount,
IN gctUINT NodeSize
);
gceSTATUS
gcfMEM_FreeAFSMemPool(
IN gcsMEM_AFS_MEM_POOL *MemPool
);
gceSTATUS
gcfMEM_AFSMemPoolGetANode(
IN gcsMEM_AFS_MEM_POOL MemPool,
IN gctUINT Count,
OUT gctPOINTER * Node
);
gceSTATUS
gcfMEM_AFSMemPoolFreeANode(
IN gcsMEM_AFS_MEM_POOL MemPool,
IN gctPOINTER Node
);
#ifdef __cplusplus
}
#endif
#endif /* __gc_hal_mem_h_ */

View File

@ -1,259 +0,0 @@
/****************************************************************************
*
* Copyright (C) 2005 - 2010 by Vivante Corp.
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*****************************************************************************/
#ifndef __gc_hal_options_h_
#define __gc_hal_options_h_
/*
USE_NEW_LINUX_SIGNAL
This define enables the Linux kernel signaling between kernel and user.
*/
#ifndef USE_NEW_LINUX_SIGNAL
# define USE_NEW_LINUX_SIGNAL 0
#endif
/*
NO_USER_DIRECT_ACCESS_FROM_KERNEL
This define enables the Linux kernel behavior accessing user memory.
*/
#ifndef NO_USER_DIRECT_ACCESS_FROM_KERNEL
# define NO_USER_DIRECT_ACCESS_FROM_KERNEL 0
#endif
/*
VIVANTE_PROFILER
This define enables the profiler.
*/
#ifndef VIVANTE_PROFILER
# define VIVANTE_PROFILER 0
#endif
/*
gcdUSE_VG
Enable VG HAL layer (only for GC350).
*/
#ifndef gcdUSE_VG
# define gcdUSE_VG 0
#endif
/*
USE_SW_FB
Set to 1 if the frame buffer memory cannot be accessed by the GPU.
*/
#ifndef USE_SW_FB
#define USE_SW_FB 0
#endif
/*
USE_SHADER_SYMBOL_TABLE
This define enables the symbol table in shader object.
*/
#define USE_SHADER_SYMBOL_TABLE 1
/*
USE_SUPER_SAMPLING
This define enables super-sampling support.
*/
#define USE_SUPER_SAMPLING 0
/*
PROFILE_HAL_COUNTERS
This define enables HAL counter profiling support.
HW and SHADER Counter profiling depends on this.
*/
#define PROFILE_HAL_COUNTERS 1
/*
PROFILE_HW_COUNTERS
This define enables HW counter profiling support.
*/
#define PROFILE_HW_COUNTERS 1
/*
PROFILE_SHADER_COUNTERS
This define enables SHADER counter profiling support.
*/
#define PROFILE_SHADER_COUNTERS 1
/*
COMMAND_PROCESSOR_VERSION
The version of the command buffer and task manager.
*/
#define COMMAND_PROCESSOR_VERSION 1
/*
gcdDUMP
When set to 1, a dump of all states and memory uploads, as well as other
hardware related execution will be printed to the debug console. This
data can be used for playing back applications.
*/
#define gcdDUMP 0
/*
gcdDUMP_API
When set to 1, a high level dump of the EGL and GL/VG APs's are
captured.
*/
#define gcdDUMP_API 0
/*
gcdDUMP_IN_KERNEL
When set to 1, all dumps will happen in the kernel. This is handy if
you want the kernel to dump its command buffers as well and the data
needs to be in sync.
*/
#define gcdDUMP_IN_KERNEL 0
/*
gcdDUMP_COMMAND
When set to non-zero, the command queue will dump all incoming command
and context buffers as well as all other modifications to the command
queue.
*/
#define gcdDUMP_COMMAND 0
/*
gcdNULL_DRIVER
*/
#define gcdNULL_DRIVER 0
/*
gcdENABLE_TIMEOUT_DETECTION
Enable timeout detection.
*/
#define gcdENABLE_TIMEOUT_DETECTION 0
/*
gcdCMD_BUFFERS
Number of command buffers to use per client. Each command buffer is 32kB in
size.
*/
#define gcdCMD_BUFFERS 2
/*
gcdPOWER_CONTROL_DELAY
The delay in milliseconds required to wait until the GPU has woke up from a
suspend or power-down state. This is system dependent because the bus clock
also needs to be stabalize.
*/
#define gcdPOWER_CONTROL_DELAY 1
/*
gcdMMU_SIZE
Size of the MMU page table in bytes. Each 4 bytes can hold 4kB worth of
virtual data.
*/
#define gcdMMU_SIZE (128 << 10)
/*
gcdSECURE_USER
Use logical addresses instead of physical addresses in user land. In this
case a hint table is created for both command buffers and context buffers,
and that hint table will be used to patch up those buffers in the kernel
when they are ready to submit.
*/
#define gcdSECURE_USER 0
/*
gcdSECURE_CACHE_SLOTS
Number of slots in the logical to DMA address cache table. Each time a
logical address needs to be translated into a DMA address for the GPU, this
cache will be walked. The replacement scheme is LRU.
*/
#define gcdSECURE_CACHE_SLOTS 64
/*
gcdREGISTER_ACCESS_FROM_USER
Set to 1 to allow IOCTL calls to get through from user land. This should
only be in debug or development drops.
*/
#ifndef gcdREGISTER_ACCESS_FROM_USER
# define gcdREGISTER_ACCESS_FROM_USER 1
#endif
/*
gcdHEAP_SIZE
Set the allocation size for the internal heaps. Each time a heap is full,
a new heap will be allocated with this minmimum amount of bytes. The bigger
this size, the fewer heaps there are to allocate, the better the
performance. However, heaps won't be freed until they are completely free,
so there might be some more memory waste if the size is too big.
*/
#define gcdHEAP_SIZE (64 << 10)
/*
gcdNO_POWER_MANAGEMENT
This define disables the power management code.
*/
#ifndef gcdNO_POWER_MANAGEMENT
# define gcdNO_POWER_MANAGEMENT 0
#endif
/*
gcdFPGA_BUILD
This define enables work arounds for FPGA images.
*/
#if !defined(gcdFPGA_BUILD)
# define gcdFPGA_BUILD 0
#endif
/*
gcdGPU_TIMEOUT
This define specified the number of milliseconds the system will wait before
it broadcasts the GPU is stuck. In other words, it will define the timeout
of any operation that needs to wait for the GPU.
If the value is 0, no timeout will be checked for.
*/
#if !defined(gcdGPU_TIMEOUT)
# define gcdGPU_TIMEOUT 0
#endif
#endif /* __gc_hal_options_h_ */

View File

@ -1,232 +0,0 @@
/****************************************************************************
*
* Copyright (C) 2005 - 2010 by Vivante Corp.
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*****************************************************************************/
#ifndef __gc_hal_profiler_h_
#define __gc_hal_profiler_h_
#ifdef __cplusplus
extern "C" {
#endif
#define GLVERTEX_OBJECT 10
#define GLVERTEX_OBJECT_BYTES 11
#define GLINDEX_OBJECT 20
#define GLINDEX_OBJECT_BYTES 21
#define GLTEXTURE_OBJECT 30
#define GLTEXTURE_OBJECT_BYTES 31
#if VIVANTE_PROFILER
#define gcmPROFILE_GC(Hal, Enum, Value) gcoPROFILER_Count(Hal, Enum, Value)
#else
#define gcmPROFILE_GC(Hal, Enum, Value) do { } while (gcvFALSE)
#endif
/* HW profile information. */
typedef struct _gcsPROFILER_COUNTERS
{
/* HW static counters. */
gctUINT32 gpuClock;
gctUINT32 axiClock;
gctUINT32 shaderClock;
/* HW vairable counters. */
gctUINT32 gpuClockStart;
gctUINT32 gpuClockEnd;
/* HW vairable counters. */
gctUINT32 gpuCyclesCounter;
gctUINT32 gpuTotalRead64BytesPerFrame;
gctUINT32 gpuTotalWrite64BytesPerFrame;
/* PE */
gctUINT32 pe_pixel_count_killed_by_color_pipe;
gctUINT32 pe_pixel_count_killed_by_depth_pipe;
gctUINT32 pe_pixel_count_drawn_by_color_pipe;
gctUINT32 pe_pixel_count_drawn_by_depth_pipe;
/* SH */
gctUINT32 ps_inst_counter;
gctUINT32 rendered_pixel_counter;
gctUINT32 vs_inst_counter;
gctUINT32 rendered_vertice_counter;
gctUINT32 vtx_branch_inst_counter;
gctUINT32 vtx_texld_inst_counter;
gctUINT32 pxl_branch_inst_counter;
gctUINT32 pxl_texld_inst_counter;
/* PA */
gctUINT32 pa_input_vtx_counter;
gctUINT32 pa_input_prim_counter;
gctUINT32 pa_output_prim_counter;
gctUINT32 pa_depth_clipped_counter;
gctUINT32 pa_trivial_rejected_counter;
gctUINT32 pa_culled_counter;
/* SE */
gctUINT32 se_culled_triangle_count;
gctUINT32 se_culled_lines_count;
/* RA */
gctUINT32 ra_valid_pixel_count;
gctUINT32 ra_total_quad_count;
gctUINT32 ra_valid_quad_count_after_early_z;
gctUINT32 ra_total_primitive_count;
gctUINT32 ra_pipe_cache_miss_counter;
gctUINT32 ra_prefetch_cache_miss_counter;
gctUINT32 ra_eez_culled_counter;
/* TX */
gctUINT32 tx_total_bilinear_requests;
gctUINT32 tx_total_trilinear_requests;
gctUINT32 tx_total_discarded_texture_requests;
gctUINT32 tx_total_texture_requests;
gctUINT32 tx_mem_read_count;
gctUINT32 tx_mem_read_in_8B_count;
gctUINT32 tx_cache_miss_count;
gctUINT32 tx_cache_hit_texel_count;
gctUINT32 tx_cache_miss_texel_count;
/* MC */
gctUINT32 mc_total_read_req_8B_from_pipeline;
gctUINT32 mc_total_read_req_8B_from_IP;
gctUINT32 mc_total_write_req_8B_from_pipeline;
/* HI */
gctUINT32 hi_axi_cycles_read_request_stalled;
gctUINT32 hi_axi_cycles_write_request_stalled;
gctUINT32 hi_axi_cycles_write_data_stalled;
}
gcsPROFILER_COUNTERS;
/* HAL profile information. */
typedef struct _gcsPROFILER
{
gctFILE file;
/* Aggregate Information */
/* Clock Info */
gctUINT64 frameStart;
gctUINT64 frameEnd;
/* Current frame information */
gctUINT32 frameNumber;
gctUINT64 frameStartTimeusec;
gctUINT64 frameEndTimeusec;
gctUINT64 frameStartCPUTimeusec;
gctUINT64 frameEndCPUTimeusec;
#if PROFILE_HAL_COUNTERS
gctUINT32 vertexBufferTotalBytesAlloc;
gctUINT32 vertexBufferNewBytesAlloc;
int vertexBufferTotalObjectsAlloc;
int vertexBufferNewObjectsAlloc;
gctUINT32 indexBufferTotalBytesAlloc;
gctUINT32 indexBufferNewBytesAlloc;
int indexBufferTotalObjectsAlloc;
int indexBufferNewObjectsAlloc;
gctUINT32 textureBufferTotalBytesAlloc;
gctUINT32 textureBufferNewBytesAlloc;
int textureBufferTotalObjectsAlloc;
int textureBufferNewObjectsAlloc;
gctUINT32 numCommits;
gctUINT32 drawPointCount;
gctUINT32 drawLineCount;
gctUINT32 drawTriangleCount;
gctUINT32 drawVertexCount;
gctUINT32 redundantStateChangeCalls;
#endif
}
gcsPROFILER;
/* Memory profile information. */
struct _gcsMemProfile
{
/* Memory Usage */
gctUINT32 videoMemUsed;
gctUINT32 systemMemUsed;
gctUINT32 commitBufferSize;
gctUINT32 contextBufferCopyBytes;
};
/* Shader profile information. */
struct _gcsSHADER_PROFILER
{
gctUINT32 shaderLength;
gctUINT32 shaderALUCycles;
gctUINT32 shaderTexLoadCycles;
gctUINT32 shaderTempRegCount;
gctUINT32 shaderSamplerRegCount;
gctUINT32 shaderInputRegCount;
gctUINT32 shaderOutputRegCount;
};
/* Initialize the gcsProfiler. */
gceSTATUS
gcoPROFILER_Initialize(
IN gcoHAL Hal,
IN gctFILE File
);
/* Destroy the gcProfiler. */
gceSTATUS
gcoPROFILER_Destroy(
IN gcoHAL Hal
);
/* Call to signal end of frame. */
gceSTATUS
gcoPROFILER_EndFrame(
IN gcoHAL Hal
);
gceSTATUS
gcoPROFILER_Count(
IN gcoHAL Hal,
IN gctUINT32 Enum,
IN gctINT Value
);
/* Profile input vertex shader. */
gceSTATUS
gcoPROFILER_ShaderVS(
IN gcoHAL Hal,
IN gctPOINTER Vs
);
/* Profile input fragment shader. */
gceSTATUS
gcoPROFILER_ShaderFS(
IN gcoHAL Hal,
IN gctPOINTER Fs
);
#ifdef __cplusplus
}
#endif
#endif /* __gc_hal_profiler_h_ */

View File

@ -1,781 +0,0 @@
/****************************************************************************
*
* Copyright (C) 2005 - 2010 by Vivante Corp.
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*****************************************************************************/
#ifndef __gc_hal_raster_h_
#define __gc_hal_raster_h_
#include "gc_hal_enum.h"
#include "gc_hal_types.h"
#ifdef __cplusplus
extern "C" {
#endif
/******************************************************************************\
****************************** Object Declarations *****************************
\******************************************************************************/
typedef struct _gcoBRUSH * gcoBRUSH;
typedef struct _gcoBRUSH_CACHE * gcoBRUSH_CACHE;
/******************************************************************************\
******************************** gcoBRUSH Object *******************************
\******************************************************************************/
/* Create a new solid color gcoBRUSH object. */
gceSTATUS
gcoBRUSH_ConstructSingleColor(
IN gcoHAL Hal,
IN gctUINT32 ColorConvert,
IN gctUINT32 Color,
IN gctUINT64 Mask,
gcoBRUSH * Brush
);
/* Create a new monochrome gcoBRUSH object. */
gceSTATUS
gcoBRUSH_ConstructMonochrome(
IN gcoHAL Hal,
IN gctUINT32 OriginX,
IN gctUINT32 OriginY,
IN gctUINT32 ColorConvert,
IN gctUINT32 FgColor,
IN gctUINT32 BgColor,
IN gctUINT64 Bits,
IN gctUINT64 Mask,
gcoBRUSH * Brush
);
/* Create a color gcoBRUSH object. */
gceSTATUS
gcoBRUSH_ConstructColor(
IN gcoHAL Hal,
IN gctUINT32 OriginX,
IN gctUINT32 OriginY,
IN gctPOINTER Address,
IN gceSURF_FORMAT Format,
IN gctUINT64 Mask,
gcoBRUSH * Brush
);
/* Destroy an gcoBRUSH object. */
gceSTATUS
gcoBRUSH_Destroy(
IN gcoBRUSH Brush
);
/******************************************************************************\
******************************** gcoSURF Object *******************************
\******************************************************************************/
/* Set cipping rectangle. */
gceSTATUS
gcoSURF_SetClipping(
IN gcoSURF Surface
);
/* Clear one or more rectangular areas. */
gceSTATUS
gcoSURF_Clear2D(
IN gcoSURF DestSurface,
IN gctUINT32 RectCount,
IN gcsRECT_PTR DestRect,
IN gctUINT32 LoColor,
IN gctUINT32 HiColor
);
/* Draw one or more Bresenham lines. */
gceSTATUS
gcoSURF_Line(
IN gcoSURF Surface,
IN gctUINT32 LineCount,
IN gcsRECT_PTR Position,
IN gcoBRUSH Brush,
IN gctUINT8 FgRop,
IN gctUINT8 BgRop
);
/* Generic rectangular blit. */
gceSTATUS
gcoSURF_Blit(
IN OPTIONAL gcoSURF SrcSurface,
IN gcoSURF DestSurface,
IN gctUINT32 RectCount,
IN OPTIONAL gcsRECT_PTR SrcRect,
IN gcsRECT_PTR DestRect,
IN OPTIONAL gcoBRUSH Brush,
IN gctUINT8 FgRop,
IN gctUINT8 BgRop,
IN OPTIONAL gceSURF_TRANSPARENCY Transparency,
IN OPTIONAL gctUINT32 TransparencyColor,
IN OPTIONAL gctPOINTER Mask,
IN OPTIONAL gceSURF_MONOPACK MaskPack
);
/* Monochrome blit. */
gceSTATUS
gcoSURF_MonoBlit(
IN gcoSURF DestSurface,
IN gctPOINTER Source,
IN gceSURF_MONOPACK SourcePack,
IN gcsPOINT_PTR SourceSize,
IN gcsPOINT_PTR SourceOrigin,
IN gcsRECT_PTR DestRect,
IN OPTIONAL gcoBRUSH Brush,
IN gctUINT8 FgRop,
IN gctUINT8 BgRop,
IN gctBOOL ColorConvert,
IN gctUINT8 MonoTransparency,
IN gceSURF_TRANSPARENCY Transparency,
IN gctUINT32 FgColor,
IN gctUINT32 BgColor
);
/* Filter blit. */
gceSTATUS
gcoSURF_FilterBlit(
IN gcoSURF SrcSurface,
IN gcoSURF DestSurface,
IN gcsRECT_PTR SrcRect,
IN gcsRECT_PTR DestRect,
IN gcsRECT_PTR DestSubRect
);
/* Enable alpha blending engine in the hardware and disengage the ROP engine. */
gceSTATUS
gcoSURF_EnableAlphaBlend(
IN gcoSURF Surface,
IN gctUINT8 SrcGlobalAlphaValue,
IN gctUINT8 DstGlobalAlphaValue,
IN gceSURF_PIXEL_ALPHA_MODE SrcAlphaMode,
IN gceSURF_PIXEL_ALPHA_MODE DstAlphaMode,
IN gceSURF_GLOBAL_ALPHA_MODE SrcGlobalAlphaMode,
IN gceSURF_GLOBAL_ALPHA_MODE DstGlobalAlphaMode,
IN gceSURF_BLEND_FACTOR_MODE SrcFactorMode,
IN gceSURF_BLEND_FACTOR_MODE DstFactorMode,
IN gceSURF_PIXEL_COLOR_MODE SrcColorMode,
IN gceSURF_PIXEL_COLOR_MODE DstColorMode
);
/* Disable alpha blending engine in the hardware and engage the ROP engine. */
gceSTATUS
gcoSURF_DisableAlphaBlend(
IN gcoSURF Surface
);
/* Copy a rectangular area with format conversion. */
gceSTATUS
gcoSURF_CopyPixels(
IN gcoSURF Source,
IN gcoSURF Target,
IN gctINT SourceX,
IN gctINT SourceY,
IN gctINT TargetX,
IN gctINT TargetY,
IN gctINT Width,
IN gctINT Height
);
/* Read surface pixel. */
gceSTATUS
gcoSURF_ReadPixel(
IN gcoSURF Surface,
IN gctPOINTER Memory,
IN gctINT X,
IN gctINT Y,
IN gceSURF_FORMAT Format,
OUT gctPOINTER PixelValue
);
/* Write surface pixel. */
gceSTATUS
gcoSURF_WritePixel(
IN gcoSURF Surface,
IN gctPOINTER Memory,
IN gctINT X,
IN gctINT Y,
IN gceSURF_FORMAT Format,
IN gctPOINTER PixelValue
);
/******************************************************************************\
********************************** gco2D Object *********************************
\******************************************************************************/
/* Construct a new gco2D object. */
gceSTATUS
gco2D_Construct(
IN gcoHAL Hal,
OUT gco2D * Hardware
);
/* Destroy an gco2D object. */
gceSTATUS
gco2D_Destroy(
IN gco2D Hardware
);
/* Sets the maximum number of brushes in the brush cache. */
gceSTATUS
gco2D_SetBrushLimit(
IN gco2D Hardware,
IN gctUINT MaxCount
);
/* Flush the brush. */
gceSTATUS
gco2D_FlushBrush(
IN gco2D Engine,
IN gcoBRUSH Brush,
IN gceSURF_FORMAT Format
);
/* Program the specified solid color brush. */
gceSTATUS
gco2D_LoadSolidBrush(
IN gco2D Engine,
IN gceSURF_FORMAT Format,
IN gctUINT32 ColorConvert,
IN gctUINT32 Color,
IN gctUINT64 Mask
);
/* Configure monochrome source. */
gceSTATUS
gco2D_SetMonochromeSource(
IN gco2D Engine,
IN gctBOOL ColorConvert,
IN gctUINT8 MonoTransparency,
IN gceSURF_MONOPACK DataPack,
IN gctBOOL CoordRelative,
IN gceSURF_TRANSPARENCY Transparency,
IN gctUINT32 FgColor,
IN gctUINT32 BgColor
);
/* Configure color source. */
gceSTATUS
gco2D_SetColorSource(
IN gco2D Engine,
IN gctUINT32 Address,
IN gctUINT32 Stride,
IN gceSURF_FORMAT Format,
IN gceSURF_ROTATION Rotation,
IN gctUINT32 SurfaceWidth,
IN gctBOOL CoordRelative,
IN gceSURF_TRANSPARENCY Transparency,
IN gctUINT32 TransparencyColor
);
/* Configure color source extension for full rotation. */
gceSTATUS
gco2D_SetColorSourceEx(
IN gco2D Engine,
IN gctUINT32 Address,
IN gctUINT32 Stride,
IN gceSURF_FORMAT Format,
IN gceSURF_ROTATION Rotation,
IN gctUINT32 SurfaceWidth,
IN gctUINT32 SurfaceHeight,
IN gctBOOL CoordRelative,
IN gceSURF_TRANSPARENCY Transparency,
IN gctUINT32 TransparencyColor
);
/* Configure color source. */
gceSTATUS
gco2D_SetColorSourceAdvanced(
IN gco2D Engine,
IN gctUINT32 Address,
IN gctUINT32 Stride,
IN gceSURF_FORMAT Format,
IN gceSURF_ROTATION Rotation,
IN gctUINT32 SurfaceWidth,
IN gctUINT32 SurfaceHeight,
IN gctBOOL CoordRelative
);
/* Configure masked color source. */
gceSTATUS
gco2D_SetMaskedSource(
IN gco2D Engine,
IN gctUINT32 Address,
IN gctUINT32 Stride,
IN gceSURF_FORMAT Format,
IN gctBOOL CoordRelative,
IN gceSURF_MONOPACK MaskPack
);
/* Configure masked color source extension for full rotation. */
gceSTATUS
gco2D_SetMaskedSourceEx(
IN gco2D Engine,
IN gctUINT32 Address,
IN gctUINT32 Stride,
IN gceSURF_FORMAT Format,
IN gctBOOL CoordRelative,
IN gceSURF_MONOPACK MaskPack,
IN gceSURF_ROTATION Rotation,
IN gctUINT32 SurfaceWidth,
IN gctUINT32 SurfaceHeight
);
/* Setup the source rectangle. */
gceSTATUS
gco2D_SetSource(
IN gco2D Engine,
IN gcsRECT_PTR SrcRect
);
/* Set clipping rectangle. */
gceSTATUS
gco2D_SetClipping(
IN gco2D Engine,
IN gcsRECT_PTR Rect
);
/* Configure destination. */
gceSTATUS
gco2D_SetTarget(
IN gco2D Engine,
IN gctUINT32 Address,
IN gctUINT32 Stride,
IN gceSURF_ROTATION Rotation,
IN gctUINT32 SurfaceWidth
);
/* Configure destination extension for full rotation. */
gceSTATUS
gco2D_SetTargetEx(
IN gco2D Engine,
IN gctUINT32 Address,
IN gctUINT32 Stride,
IN gceSURF_ROTATION Rotation,
IN gctUINT32 SurfaceWidth,
IN gctUINT32 SurfaceHeight
);
/* Calculate and program the stretch factors. */
gceSTATUS
gco2D_SetStretchFactors(
IN gco2D Engine,
IN gctUINT32 HorFactor,
IN gctUINT32 VerFactor
);
/* Calculate and program the stretch factors based on the rectangles. */
gceSTATUS
gco2D_SetStretchRectFactors(
IN gco2D Engine,
IN gcsRECT_PTR SrcRect,
IN gcsRECT_PTR DestRect
);
/* Create a new solid color gcoBRUSH object. */
gceSTATUS
gco2D_ConstructSingleColorBrush(
IN gco2D Engine,
IN gctUINT32 ColorConvert,
IN gctUINT32 Color,
IN gctUINT64 Mask,
gcoBRUSH * Brush
);
/* Create a new monochrome gcoBRUSH object. */
gceSTATUS
gco2D_ConstructMonochromeBrush(
IN gco2D Engine,
IN gctUINT32 OriginX,
IN gctUINT32 OriginY,
IN gctUINT32 ColorConvert,
IN gctUINT32 FgColor,
IN gctUINT32 BgColor,
IN gctUINT64 Bits,
IN gctUINT64 Mask,
gcoBRUSH * Brush
);
/* Create a color gcoBRUSH object. */
gceSTATUS
gco2D_ConstructColorBrush(
IN gco2D Engine,
IN gctUINT32 OriginX,
IN gctUINT32 OriginY,
IN gctPOINTER Address,
IN gceSURF_FORMAT Format,
IN gctUINT64 Mask,
gcoBRUSH * Brush
);
/* Clear one or more rectangular areas. */
gceSTATUS
gco2D_Clear(
IN gco2D Engine,
IN gctUINT32 RectCount,
IN gcsRECT_PTR Rect,
IN gctUINT32 Color32,
IN gctUINT8 FgRop,
IN gctUINT8 BgRop,
IN gceSURF_FORMAT DestFormat
);
/* Draw one or more Bresenham lines. */
gceSTATUS
gco2D_Line(
IN gco2D Engine,
IN gctUINT32 LineCount,
IN gcsRECT_PTR Position,
IN gcoBRUSH Brush,
IN gctUINT8 FgRop,
IN gctUINT8 BgRop,
IN gceSURF_FORMAT DestFormat
);
/* Draw one or more Bresenham lines based on the 32-bit color. */
gceSTATUS
gco2D_ColorLine(
IN gco2D Engine,
IN gctUINT32 LineCount,
IN gcsRECT_PTR Position,
IN gctUINT32 Color32,
IN gctUINT8 FgRop,
IN gctUINT8 BgRop,
IN gceSURF_FORMAT DestFormat
);
/* Generic blit. */
gceSTATUS
gco2D_Blit(
IN gco2D Engine,
IN gctUINT32 RectCount,
IN gcsRECT_PTR Rect,
IN gctUINT8 FgRop,
IN gctUINT8 BgRop,
IN gceSURF_FORMAT DestFormat
);
/* Batch blit. */
gceSTATUS
gco2D_BatchBlit(
IN gco2D Engine,
IN gctUINT32 RectCount,
IN gcsRECT_PTR SrcRect,
IN gcsRECT_PTR DestRect,
IN gctUINT8 FgRop,
IN gctUINT8 BgRop,
IN gceSURF_FORMAT DestFormat
);
/* Stretch blit. */
gceSTATUS
gco2D_StretchBlit(
IN gco2D Engine,
IN gctUINT32 RectCount,
IN gcsRECT_PTR Rect,
IN gctUINT8 FgRop,
IN gctUINT8 BgRop,
IN gceSURF_FORMAT DestFormat
);
/* Monochrome blit. */
gceSTATUS
gco2D_MonoBlit(
IN gco2D Engine,
IN gctPOINTER StreamBits,
IN gcsPOINT_PTR StreamSize,
IN gcsRECT_PTR StreamRect,
IN gceSURF_MONOPACK SrcStreamPack,
IN gceSURF_MONOPACK DestStreamPack,
IN gcsRECT_PTR DestRect,
IN gctUINT32 FgRop,
IN gctUINT32 BgRop,
IN gceSURF_FORMAT DestFormat
);
/* Set kernel size. */
gceSTATUS
gco2D_SetKernelSize(
IN gco2D Engine,
IN gctUINT8 HorKernelSize,
IN gctUINT8 VerKernelSize
);
/* Set filter type. */
gceSTATUS
gco2D_SetFilterType(
IN gco2D Engine,
IN gceFILTER_TYPE FilterType
);
/* Set the filter kernel by user. */
gceSTATUS
gco2D_SetUserFilterKernel(
IN gco2D Engine,
IN gceFILTER_PASS_TYPE PassType,
IN gctUINT16_PTR KernelArray
);
/* Select the pass(es) to be done for user defined filter. */
gceSTATUS
gco2D_EnableUserFilterPasses(
IN gco2D Engine,
IN gctBOOL HorPass,
IN gctBOOL VerPass
);
/* Frees the temporary buffer allocated by filter blit operation. */
gceSTATUS
gco2D_FreeFilterBuffer(
IN gco2D Engine
);
/* Filter blit. */
gceSTATUS
gco2D_FilterBlit(
IN gco2D Engine,
IN gctUINT32 SrcAddress,
IN gctUINT SrcStride,
IN gctUINT32 SrcUAddress,
IN gctUINT SrcUStride,
IN gctUINT32 SrcVAddress,
IN gctUINT SrcVStride,
IN gceSURF_FORMAT SrcFormat,
IN gceSURF_ROTATION SrcRotation,
IN gctUINT32 SrcSurfaceWidth,
IN gcsRECT_PTR SrcRect,
IN gctUINT32 DestAddress,
IN gctUINT DestStride,
IN gceSURF_FORMAT DestFormat,
IN gceSURF_ROTATION DestRotation,
IN gctUINT32 DestSurfaceWidth,
IN gcsRECT_PTR DestRect,
IN gcsRECT_PTR DestSubRect
);
/* Filter blit extension for full rotation. */
gceSTATUS
gco2D_FilterBlitEx(
IN gco2D Engine,
IN gctUINT32 SrcAddress,
IN gctUINT SrcStride,
IN gctUINT32 SrcUAddress,
IN gctUINT SrcUStride,
IN gctUINT32 SrcVAddress,
IN gctUINT SrcVStride,
IN gceSURF_FORMAT SrcFormat,
IN gceSURF_ROTATION SrcRotation,
IN gctUINT32 SrcSurfaceWidth,
IN gctUINT32 SrcSurfaceHeight,
IN gcsRECT_PTR SrcRect,
IN gctUINT32 DestAddress,
IN gctUINT DestStride,
IN gceSURF_FORMAT DestFormat,
IN gceSURF_ROTATION DestRotation,
IN gctUINT32 DestSurfaceWidth,
IN gctUINT32 DestSurfaceHeight,
IN gcsRECT_PTR DestRect,
IN gcsRECT_PTR DestSubRect
);
/* Enable alpha blending engine in the hardware and disengage the ROP engine. */
gceSTATUS
gco2D_EnableAlphaBlend(
IN gco2D Engine,
IN gctUINT8 SrcGlobalAlphaValue,
IN gctUINT8 DstGlobalAlphaValue,
IN gceSURF_PIXEL_ALPHA_MODE SrcAlphaMode,
IN gceSURF_PIXEL_ALPHA_MODE DstAlphaMode,
IN gceSURF_GLOBAL_ALPHA_MODE SrcGlobalAlphaMode,
IN gceSURF_GLOBAL_ALPHA_MODE DstGlobalAlphaMode,
IN gceSURF_BLEND_FACTOR_MODE SrcFactorMode,
IN gceSURF_BLEND_FACTOR_MODE DstFactorMode,
IN gceSURF_PIXEL_COLOR_MODE SrcColorMode,
IN gceSURF_PIXEL_COLOR_MODE DstColorMode
);
/* Enable alpha blending engine in the hardware. */
gceSTATUS
gco2D_EnableAlphaBlendAdvanced(
IN gco2D Engine,
IN gceSURF_PIXEL_ALPHA_MODE SrcAlphaMode,
IN gceSURF_PIXEL_ALPHA_MODE DstAlphaMode,
IN gceSURF_GLOBAL_ALPHA_MODE SrcGlobalAlphaMode,
IN gceSURF_GLOBAL_ALPHA_MODE DstGlobalAlphaMode,
IN gceSURF_BLEND_FACTOR_MODE SrcFactorMode,
IN gceSURF_BLEND_FACTOR_MODE DstFactorMode
);
/* Enable alpha blending engine with Porter Duff rule. */
gceSTATUS
gco2D_SetPorterDuffBlending(
IN gco2D Engine,
IN gce2D_PORTER_DUFF_RULE Rule
);
/* Disable alpha blending engine in the hardware and engage the ROP engine. */
gceSTATUS
gco2D_DisableAlphaBlend(
IN gco2D Engine
);
/* Retrieve the maximum number of 32-bit data chunks for a single DE command. */
gctUINT32
gco2D_GetMaximumDataCount(
void
);
/* Retrieve the maximum number of rectangles, that can be passed in a single DE command. */
gctUINT32
gco2D_GetMaximumRectCount(
void
);
/* Returns the pixel alignment of the surface. */
gceSTATUS
gco2D_GetPixelAlignment(
gceSURF_FORMAT Format,
gcsPOINT_PTR Alignment
);
/* Retrieve monochrome stream pack size. */
gceSTATUS
gco2D_GetPackSize(
IN gceSURF_MONOPACK StreamPack,
OUT gctUINT32 * PackWidth,
OUT gctUINT32 * PackHeight
);
/* Flush the 2D pipeline. */
gceSTATUS
gco2D_Flush(
IN gco2D Engine
);
/* Load 256-entry color table for INDEX8 source surfaces. */
gceSTATUS
gco2D_LoadPalette(
IN gco2D Engine,
IN gctUINT FirstIndex,
IN gctUINT IndexCount,
IN gctPOINTER ColorTable,
IN gctBOOL ColorConvert
);
/* Enable/disable 2D BitBlt mirrorring. */
gceSTATUS
gco2D_SetBitBlitMirror(
IN gco2D Engine,
IN gctBOOL HorizontalMirror,
IN gctBOOL VerticalMirror
);
/* Set the transparency for source, destination and pattern. */
gceSTATUS
gco2D_SetTransparencyAdvanced(
IN gco2D Engine,
IN gce2D_TRANSPARENCY SrcTransparency,
IN gce2D_TRANSPARENCY DstTransparency,
IN gce2D_TRANSPARENCY PatTransparency
);
/* Set the source color key. */
gceSTATUS
gco2D_SetSourceColorKeyAdvanced(
IN gco2D Engine,
IN gctUINT32 ColorKey
);
/* Set the source color key range. */
gceSTATUS
gco2D_SetSourceColorKeyRangeAdvanced(
IN gco2D Engine,
IN gctUINT32 ColorKeyLow,
IN gctUINT32 ColorKeyHigh
);
/* Set the target color key. */
gceSTATUS
gco2D_SetTargetColorKeyAdvanced(
IN gco2D Engine,
IN gctUINT32 ColorKey
);
/* Set the target color key range. */
gceSTATUS
gco2D_SetTargetColorKeyRangeAdvanced(
IN gco2D Engine,
IN gctUINT32 ColorKeyLow,
IN gctUINT32 ColorKeyHigh
);
/* Set the YUV color space mode. */
gceSTATUS
gco2D_SetYUVColorMode(
IN gco2D Engine,
IN gce2D_YUV_COLOR_MODE Mode
);
/* Setup the source global color value in ARGB8 format. */
gceSTATUS gco2D_SetSourceGlobalColorAdvanced(
IN gco2D Engine,
IN gctUINT32 Color32
);
/* Setup the target global color value in ARGB8 format. */
gceSTATUS gco2D_SetTargetGlobalColorAdvanced(
IN gco2D Engine,
IN gctUINT32 Color32
);
/* Setup the source and target pixel multiply modes. */
gceSTATUS
gco2D_SetPixelMultiplyModeAdvanced(
IN gco2D Engine,
IN gce2D_PIXEL_COLOR_MULTIPLY_MODE SrcPremultiplySrcAlpha,
IN gce2D_PIXEL_COLOR_MULTIPLY_MODE DstPremultiplyDstAlpha,
IN gce2D_GLOBAL_COLOR_MULTIPLY_MODE SrcPremultiplyGlobalMode,
IN gce2D_PIXEL_COLOR_MULTIPLY_MODE DstDemultiplyDstAlpha
);
/* Set the GPU clock cycles after which the idle engine will keep auto-flushing. */
gceSTATUS
gco2D_SetAutoFlushCycles(
IN gco2D Engine,
IN gctUINT32 Cycles
);
/* Read the profile registers available in the 2D engine and sets them in the profile.
The function will also reset the pixelsRendered counter every time.
*/
gceSTATUS
gco2D_ProfileEngine(
IN gco2D Engine,
OPTIONAL gcs2D_PROFILE_PTR Profile
);
#ifdef __cplusplus
}
#endif
#endif /* __gc_hal_raster_h_ */

View File

@ -1,544 +0,0 @@
/****************************************************************************
*
* Copyright (C) 2005 - 2010 by Vivante Corp.
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*****************************************************************************/
#ifndef __gc_hal_types_h_
#define __gc_hal_types_h_
#include "gc_hal_options.h"
#ifdef _WIN32
#pragma warning(disable:4127) /* Conditional expression is constant (do { }
** while(0)). */
#pragma warning(disable:4100) /* Unreferenced formal parameter. */
#pragma warning(disable:4204) /* Non-constant aggregate initializer (C99). */
#pragma warning(disable:4131) /* Uses old-style declarator (for Bison and
** Flex generated files). */
#pragma warning(disable:4206) /* Translation unit is empty. */
#endif
#ifdef __cplusplus
extern "C" {
#endif
/******************************************************************************\
** Platform macros.
*/
#if defined(__GNUC__)
# define gcdHAS_ELLIPSES 1 /* GCC always has it. */
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
# define gcdHAS_ELLIPSES 1 /* C99 has it. */
#elif defined(_MSC_VER) && (_MSC_VER >= 1500)
# define gcdHAS_ELLIPSES 1 /* MSVC 2007+ has it. */
#elif defined(UNDER_CE)
# define gcdHAS_ELLIPSES 0 /* Windows CE doesn't have it. */
#else
# error "gcdHAS_ELLIPSES: Platform could not be determined"
#endif
/******************************************************************************\
************************************ Keyword ***********************************
\******************************************************************************/
#if (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))
# define gcmINLINE inline /* C99 keyword. */
#elif defined(__GNUC__)
# define gcmINLINE __inline__ /* GNU keyword. */
#elif defined(_MSC_VER) || defined(UNDER_CE)
# define gcmINLINE __inline /* Internal keyword. */
#else
# error "gcmINLINE: Platform could not be determined"
#endif
#ifndef gcdDEBUG
# if (defined(DBG) && DBG) || defined(DEBUG) || defined(_DEBUG)
# define gcdDEBUG 1
# else
# define gcdDEBUG 0
# endif
#endif
#ifdef _USRDLL
# ifdef _MSC_VER
# ifdef HAL_EXPORTS
# define HALAPI __declspec(dllexport)
# else
# define HALAPI __declspec(dllimport)
# endif
# define HALDECL __cdecl
# else
# ifdef HAL_EXPORTS
# define HALAPI
# else
# define HALAPI extern
# endif
# endif
#else
# define HALAPI
# define HALDECL
#endif
/******************************************************************************\
********************************** Common Types ********************************
\******************************************************************************/
#define gcvFALSE 0
#define gcvTRUE 1
#define gcvINFINITE ((gctUINT32) ~0U)
typedef int gctBOOL;
typedef gctBOOL * gctBOOL_PTR;
typedef int gctINT;
typedef signed char gctINT8;
typedef signed short gctINT16;
typedef signed int gctINT32;
typedef signed long long gctINT64;
typedef gctINT * gctINT_PTR;
typedef gctINT8 * gctINT8_PTR;
typedef gctINT16 * gctINT16_PTR;
typedef gctINT32 * gctINT32_PTR;
typedef gctINT64 * gctINT64_PTR;
typedef unsigned int gctUINT;
typedef unsigned char gctUINT8;
typedef unsigned short gctUINT16;
typedef unsigned int gctUINT32;
typedef unsigned long long gctUINT64;
typedef gctUINT * gctUINT_PTR;
typedef gctUINT8 * gctUINT8_PTR;
typedef gctUINT16 * gctUINT16_PTR;
typedef gctUINT32 * gctUINT32_PTR;
typedef gctUINT64 * gctUINT64_PTR;
typedef unsigned long gctSIZE_T;
typedef gctSIZE_T * gctSIZE_T_PTR;
#ifdef __cplusplus
# define gcvNULL 0
#else
# define gcvNULL ((void *) 0)
#endif
typedef float gctFLOAT;
typedef signed int gctFIXED_POINT;
typedef float * gctFLOAT_PTR;
typedef void * gctPHYS_ADDR;
typedef void * gctHANDLE;
typedef void * gctFILE;
typedef void * gctSIGNAL;
typedef void * gctWINDOW;
typedef void * gctIMAGE;
typedef void * gctPOINTER;
typedef const void * gctCONST_POINTER;
typedef char gctCHAR;
typedef char * gctSTRING;
typedef const char * gctCONST_STRING;
typedef struct _gcsCOUNT_STRING
{
gctSIZE_T Length;
gctCONST_STRING String;
}
gcsCOUNT_STRING;
/* Fixed point constants. */
#define gcvZERO_X ((gctFIXED_POINT) 0x00000000)
#define gcvHALF_X ((gctFIXED_POINT) 0x00008000)
#define gcvONE_X ((gctFIXED_POINT) 0x00010000)
#define gcvNEGONE_X ((gctFIXED_POINT) 0xFFFF0000)
#define gcvTWO_X ((gctFIXED_POINT) 0x00020000)
/******************************************************************************\
******************************* Fixed Point Math *******************************
\******************************************************************************/
#define gcmXMultiply(x1, x2) \
(gctFIXED_POINT) (((gctINT64) (x1) * (x2)) >> 16)
#define gcmXDivide(x1, x2) \
(gctFIXED_POINT) ((((gctINT64) (x1)) << 16) / (x2))
#define gcmXMultiplyDivide(x1, x2, x3) \
(gctFIXED_POINT) ((gctINT64) (x1) * (x2) / (x3))
/* 2D Engine profile. */
struct gcs2D_PROFILE
{
/* Cycle count.
32bit counter incremented every 2D clock cycle.
Wraps back to 0 when the counter overflows.
*/
gctUINT32 cycleCount;
/* Pixels rendered by the 2D engine.
Resets to 0 every time it is read. */
gctUINT32 pixelsRendered;
};
/* Macro to combine four characters into a Charcater Code. */
#define gcmCC(c1, c2, c3, c4) \
( \
(char) (c1) \
| \
((char) (c2) << 8) \
| \
((char) (c3) << 16) \
| \
((char) (c4) << 24) \
)
#define gcmPRINTABLE(c) ((((c) >= ' ') && ((c) <= '}')) ? (c) : ' ')
#define gcmCC_PRINT(cc) \
gcmPRINTABLE((char) ( (cc) & 0xFF)), \
gcmPRINTABLE((char) (((cc) >> 8) & 0xFF)), \
gcmPRINTABLE((char) (((cc) >> 16) & 0xFF)), \
gcmPRINTABLE((char) (((cc) >> 24) & 0xFF))
/******************************************************************************\
****************************** Function Parameters *****************************
\******************************************************************************/
#define IN
#define OUT
#define OPTIONAL
/******************************************************************************\
********************************* Status Codes *********************************
\******************************************************************************/
typedef enum _gceSTATUS
{
gcvSTATUS_OK = 0,
gcvSTATUS_FALSE = 0,
gcvSTATUS_TRUE = 1,
gcvSTATUS_NO_MORE_DATA = 2,
gcvSTATUS_CACHED = 3,
gcvSTATUS_MIPMAP_TOO_LARGE = 4,
gcvSTATUS_NAME_NOT_FOUND = 5,
gcvSTATUS_NOT_OUR_INTERRUPT = 6,
gcvSTATUS_MISMATCH = 7,
gcvSTATUS_MIPMAP_TOO_SMALL = 8,
gcvSTATUS_LARGER = 9,
gcvSTATUS_SMALLER = 10,
gcvSTATUS_CHIP_NOT_READY = 11,
gcvSTATUS_NEED_CONVERSION = 12,
gcvSTATUS_SKIP = 13,
gcvSTATUS_DATA_TOO_LARGE = 14,
gcvSTATUS_INVALID_CONFIG = 15,
gcvSTATUS_CHANGED = 16,
gcvSTATUS_INVALID_ARGUMENT = -1,
gcvSTATUS_INVALID_OBJECT = -2,
gcvSTATUS_OUT_OF_MEMORY = -3,
gcvSTATUS_MEMORY_LOCKED = -4,
gcvSTATUS_MEMORY_UNLOCKED = -5,
gcvSTATUS_HEAP_CORRUPTED = -6,
gcvSTATUS_GENERIC_IO = -7,
gcvSTATUS_INVALID_ADDRESS = -8,
gcvSTATUS_CONTEXT_LOSSED = -9,
gcvSTATUS_TOO_COMPLEX = -10,
gcvSTATUS_BUFFER_TOO_SMALL = -11,
gcvSTATUS_INTERFACE_ERROR = -12,
gcvSTATUS_NOT_SUPPORTED = -13,
gcvSTATUS_MORE_DATA = -14,
gcvSTATUS_TIMEOUT = -15,
gcvSTATUS_OUT_OF_RESOURCES = -16,
gcvSTATUS_INVALID_DATA = -17,
gcvSTATUS_INVALID_MIPMAP = -18,
gcvSTATUS_NOT_FOUND = -19,
gcvSTATUS_NOT_ALIGNED = -20,
gcvSTATUS_INVALID_REQUEST = -21,
gcvSTATUS_GPU_NOT_RESPONDING = -22,
/* Linker errors. */
gcvSTATUS_GLOBAL_TYPE_MISMATCH = -1000,
gcvSTATUS_TOO_MANY_ATTRIBUTES = -1001,
gcvSTATUS_TOO_MANY_UNIFORMS = -1002,
gcvSTATUS_TOO_MANY_VARYINGS = -1003,
gcvSTATUS_UNDECLARED_VARYING = -1004,
gcvSTATUS_VARYING_TYPE_MISMATCH = -1005,
gcvSTATUS_MISSING_MAIN = -1006,
gcvSTATUS_NAME_MISMATCH = -1007,
gcvSTATUS_INVALID_INDEX = -1008,
}
gceSTATUS;
/******************************************************************************\
********************************* Status Macros ********************************
\******************************************************************************/
#define gcmIS_ERROR(status) (status < 0)
#define gcmNO_ERROR(status) (status >= 0)
#define gcmIS_SUCCESS(status) (status == gcvSTATUS_OK)
/******************************************************************************\
********************************* Field Macros *********************************
\******************************************************************************/
#define __gcmSTART(reg_field) \
(0 ? reg_field)
#define __gcmEND(reg_field) \
(1 ? reg_field)
#define __gcmGETSIZE(reg_field) \
(__gcmEND(reg_field) - __gcmSTART(reg_field) + 1)
#define __gcmALIGN(data, reg_field) \
(((gctUINT32) (data)) << __gcmSTART(reg_field))
#define __gcmMASK(reg_field) \
((gctUINT32) ((__gcmGETSIZE(reg_field) == 32) \
? ~0 \
: (~(~0 << __gcmGETSIZE(reg_field)))))
/*******************************************************************************
**
** gcmFIELDMASK
**
** Get aligned field mask.
**
** ARGUMENTS:
**
** reg Name of register.
** field Name of field within register.
*/
#define gcmFIELDMASK(reg, field) \
( \
__gcmALIGN(__gcmMASK(reg##_##field), reg##_##field) \
)
/*******************************************************************************
**
** gcmGETFIELD
**
** Extract the value of a field from specified data.
**
** ARGUMENTS:
**
** data Data value.
** reg Name of register.
** field Name of field within register.
*/
#define gcmGETFIELD(data, reg, field) \
( \
((((gctUINT32) (data)) >> __gcmSTART(reg##_##field)) \
& __gcmMASK(reg##_##field)) \
)
/*******************************************************************************
**
** gcmSETFIELD
**
** Set the value of a field within specified data.
**
** ARGUMENTS:
**
** data Data value.
** reg Name of register.
** field Name of field within register.
** value Value for field.
*/
#define gcmSETFIELD(data, reg, field, value) \
( \
(((gctUINT32) (data)) \
& ~__gcmALIGN(__gcmMASK(reg##_##field), reg##_##field)) \
| __gcmALIGN((gctUINT32) (value) \
& __gcmMASK(reg##_##field), reg##_##field) \
)
/*******************************************************************************
**
** gcmSETFIELDVALUE
**
** Set the value of a field within specified data with a
** predefined value.
**
** ARGUMENTS:
**
** data Data value.
** reg Name of register.
** field Name of field within register.
** value Name of the value within the field.
*/
#define gcmSETFIELDVALUE(data, reg, field, value) \
( \
(((gctUINT32) (data)) \
& ~__gcmALIGN(__gcmMASK(reg##_##field), reg##_##field)) \
| __gcmALIGN(reg##_##field##_##value \
& __gcmMASK(reg##_##field), reg##_##field) \
)
/*******************************************************************************
**
** gcmSETMASKEDFIELD
**
** Set the value of a masked field with specified data.
**
** ARGUMENTS:
**
** reg Name of register.
** field Name of field within register.
** value Value for field.
*/
#define gcmSETMASKEDFIELD(reg, field, value) \
( \
gcmSETFIELD(~0, reg, field, value) & \
gcmSETFIELDVALUE(~0, reg, MASK_ ## field, ENABLED) \
)
/*******************************************************************************
**
** gcmVERIFYFIELDVALUE
**
** Verify if the value of a field within specified data equals a
** predefined value.
**
** ARGUMENTS:
**
** data Data value.
** reg Name of register.
** field Name of field within register.
** value Name of the value within the field.
*/
#define gcmVERIFYFIELDVALUE(data, reg, field, value) \
( \
(((gctUINT32) (data)) >> __gcmSTART(reg##_##field) & \
__gcmMASK(reg##_##field)) \
== \
(reg##_##field##_##value & __gcmMASK(reg##_##field)) \
)
/*******************************************************************************
** Bit field macros.
*/
#define __gcmSTARTBIT(Field) \
( 1 ? Field )
#define __gcmBITSIZE(Field) \
( 0 ? Field )
#define __gcmBITMASK(Field) \
( \
(1 << __gcmBITSIZE(Field)) - 1 \
)
#define gcmGETBITS(Value, Type, Field) \
( \
( ((Type) (Value)) >> __gcmSTARTBIT(Field) ) \
& \
__gcmBITMASK(Field) \
)
#define gcmSETBITS(Value, Type, Field, NewValue) \
( \
( ((Type) (Value)) \
& ~(__gcmBITMASK(Field) << __gcmSTARTBIT(Field)) \
) \
| \
( ( ((Type) (NewValue)) \
& __gcmBITMASK(Field) \
) << __gcmSTARTBIT(Field) \
) \
)
/******************************************************************************\
******************************** Min/Max Macros ********************************
\******************************************************************************/
#define gcmMIN(x, y) (((x) <= (y)) ? (x) : (y))
#define gcmMAX(x, y) (((x) >= (y)) ? (x) : (y))
#define gcmCLAMP(x, min, max) (((x) < (min)) ? (min) : \
((x) > (max)) ? (max) : (x))
#define gcmABS(x) (((x) < 0) ? -(x) : (x))
#define gcmNEG(x) (((x) < 0) ? (x) : -(x))
/*******************************************************************************
**
** gcmPTR2INT
**
** Convert a pointer to an integer value.
**
** ARGUMENTS:
**
** p Pointer value.
*/
#if defined(_WIN32) || (defined(__LP64__) && __LP64__)
# define gcmPTR2INT(p) \
( \
(gctUINT32) (gctUINT64) (p) \
)
#else
# define gcmPTR2INT(p) \
( \
(gctUINT32) (p) \
)
#endif
/*******************************************************************************
**
** gcmINT2PTR
**
** Convert an integer value into a pointer.
**
** ARGUMENTS:
**
** v Integer value.
*/
#define gcmINT2PTR(i) \
( \
(gctPOINTER) (i) \
)
/*******************************************************************************
**
** gcmOFFSETOF
**
** Compute the byte offset of a field inside a structure.
**
** ARGUMENTS:
**
** s Structure name.
** field Field name.
*/
#define gcmOFFSETOF(s, field) \
( \
gcmPTR2INT(& (((struct s *) 0)->field)) \
)
#ifdef __cplusplus
}
#endif
#endif /* __gc_hal_types_h_ */

View File

@ -1,840 +0,0 @@
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <stdint.h>
#include <assert.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <linux/types.h>
#include <libhardware2/rmem.h>
#include <libhardware2/fb.h>
#include <gc_hal.h>
#include <gc_hal_base.h>
#include <gc_hal_raster.h>
#include <libhardware2/fb.h>
//#include <libutils2/boot_time.h>
//#include <sys/cachectl.h>
//DCACHE defined in asm/cachectl.h
#define DCACHE 3
#include <stdlib.h>
#include <lib2d/ingenic2d.h>
#include <libhardware2/rmem.h>
struct ingenic_2d {
gcoOS g_os;
gcoHAL g_hal;
gco2D g_2d;
int rmem_fd;
};
struct g2d_frame {
struct ingenic_2d_frame frame;
int is_rmem_frame;
gcoSURF surf;
};
static int ingenic_format_to_2d_format(enum ingenic_2d_format format)
{
switch (format) {
case INGENIC_2D_ARGB8888: return gcvSURF_A8R8G8B8;
case INGENIC_2D_RGB565: return gcvSURF_R5G6B5;
case INGENIC_2D_XRGB8888: return gcvSURF_X8R8G8B8;
case INGENIC_2D_YUYV422: return gcvSURF_YUY2;
case INGENIC_2D_UYVY422: return gcvSURF_UYVY;
default:
fprintf(stderr, "ingenic_2d: not support this format = %d\n", format);
break;
}
return -1;
}
static void to_2d_rect(struct ingenic_2d_rect *ingenic_2d, gcsRECT *rect)
{
rect->left = ingenic_2d->x;
rect->top = ingenic_2d->y;
rect->right = ingenic_2d->x + ingenic_2d->w;
rect->bottom = ingenic_2d->y + ingenic_2d->h;
}
static int ingenic_2d_work_out(struct ingenic_2d *ingenic_2d, struct g2d_frame *src, struct g2d_frame *dst)
{
int ret;
if (src) {
ret = gcoSURF_CPUCacheOperation(src->surf, gcvCACHE_CLEAN);
if (ret < 0) {
fprintf(stderr, "ingenic_2d : failed to cache srcframe\n");
return -1;
}
}
if (dst) {
ret = gcoSURF_CPUCacheOperation(dst->surf, gcvCACHE_CLEAN);
if (ret < 0) {
fprintf(stderr, "ingenic_2d: failed to cache dst_frame\n");
return -1;
}
}
ret = gco2D_Flush(ingenic_2d->g_2d);
if (ret < 0){
fprintf(stderr, "ingenic_2d: failed to flush\n");
return -1;
}
ret = gcoHAL_Commit(ingenic_2d->g_hal, gcvTRUE);
if (ret < 0) {
fprintf(stderr, "inegnic_2d: failed to commit\n");
return -1;
}
return 0;
}
static int init_frame_info(struct ingenic_2d *ingenic_2d, struct g2d_frame *frame, int width ,int height, enum ingenic_2d_format format)
{
gceSURF_FORMAT g2d_format = ingenic_format_to_2d_format(format);
if (g2d_format < 0) {
return -1;
}
int ret = gcoSURF_Construct(ingenic_2d->g_hal,
width,
height,
1,
gcvSURF_BITMAP,
g2d_format,
gcvPOOL_USER,
&frame->surf);
if (ret < 0) {
fprintf(stderr, "failed to construct 2d surf\n");
return -1;
}
struct ingenic_2d_frame *ingenic_frame = &frame->frame;
ingenic_frame->width = width;
ingenic_frame->height = height;
ingenic_frame->format = format;
ret = gcoSURF_GetAlignedSize(frame->surf, &ingenic_frame->align_width, &ingenic_frame->align_height, &ingenic_frame->stride);
if (ret < 0) {
fprintf(stderr, "failed to get surf size message\n");
gcoSURF_Destroy(frame->surf);
return -1;
}
ingenic_frame->frame_size = ingenic_frame->align_height * ingenic_frame->stride;
return 0;
}
static void deinit_frame_info(struct g2d_frame *frame)
{
gcoSURF_Destroy(frame->surf);
memset(frame, 0, sizeof(*frame));
}
static int set_frame_buffer_by_user(struct g2d_frame *frame, unsigned long phyaddr, void *addr, int size)
{
struct ingenic_2d_frame *ingenic_frame = &frame->frame;
if (ingenic_frame->frame_size < 0) {
fprintf(stderr, "ingenic_2d :failed to set frame buffer\n");
return -1;
}
int ret;
ret = gcoSURF_MapUserSurface(frame->surf, ingenic_frame->stride, (gctPOINTER)addr, phyaddr);
if (ret < 0) {
fprintf(stderr, "ingenic_2d: failed to init phy frame, map user surface err\n");
return -1;
}
ret = gcoSURF_Lock(frame->surf, ingenic_frame->phyaddr, (gctPOINTER * )ingenic_frame->addr);
if (ret < 0) {
fprintf(stderr, "ingenic_2d : failed to get surf mem\n");
return -1;
}
return 0;
}
static int get_frame_buffer(struct ingenic_2d *ingenic_2d, struct g2d_frame *frame)
{
int ret;
struct ingenic_2d_frame *ingenic_frame = &frame->frame;
unsigned long phyaddr;
void *addr = rmem_alloc(ingenic_2d->rmem_fd, &phyaddr, ingenic_frame->frame_size);
if (!addr)
return -1;
ret = set_frame_buffer_by_user(frame, phyaddr, addr, ingenic_frame->frame_size);
if (ret < 0) {
fprintf(stderr, "failed to set frame buffer\n");
return -1;
}
frame->is_rmem_frame = 1;
memset(ingenic_frame->addr[0], 0, ingenic_frame->align_height * ingenic_frame->stride);
cacheflush((void*)ingenic_frame->addr[0], ingenic_frame->align_height * ingenic_frame->stride, DCACHE);
return 0;
}
static void put_frame_buffer(struct ingenic_2d *ingenic_2d, struct g2d_frame *frame)
{
struct ingenic_2d_frame *ingenic_frame = &frame->frame;
gcoSURF_Unlock(frame->surf, ingenic_frame->addr[0]);
if (frame->is_rmem_frame)
rmem_free(ingenic_2d->rmem_fd, ingenic_frame->addr[0], ingenic_frame->phyaddr[0], ingenic_frame->frame_size);
}
static int g2d_driver_init(struct ingenic_2d *ingenic_2d)
{
int ret;
gcoOS g_os;
gcoHAL g_hal;
gco2D g_2d;
ret = gcoOS_Construct(NULL, &g_os);
if (ret < 0) {
printf("ingenic_2d: Failed to construct OS object (status = %d)\n", ret);
return -1;
}
/* Construct the gcoHAL object. */
ret = gcoHAL_Construct(NULL, g_os, &g_hal);
if (ret < 0) {
printf("ingenic_2d: Failed to construct GAL object (status = %d)\n", ret);
goto destroy_os;
}
ret = gcoHAL_Get2DEngine(g_hal, &g_2d);
if (ret < 0) {
printf("ingenic_2d : Failed to get 2D engine object (ret = %d)\n", ret);
goto destroy_hal;
}
unsigned long contiguous_size = 0;
void *contiguous_phy = 0;
gcoHAL_QueryVideoMemory(g_hal, NULL, NULL, NULL, NULL, &contiguous_phy, &contiguous_size);
if (contiguous_size > 0) {
fprintf(stderr, "g2d driver is alloced %ld mem, set kerenl g2d driver config to be zero!!\n", contiguous_size);
}
ingenic_2d->g_2d = g_2d;
ingenic_2d->g_hal = g_hal;
ingenic_2d->g_os = g_os;
return 0;
destroy_hal:
gcoHAL_Destroy(g_hal);
destroy_os:
gcoOS_Destroy(g_os);
return -1;
}
static void g2d_deinit(struct ingenic_2d *ingenic_2d)
{
gcoHAL_Commit(ingenic_2d->g_hal, 1);
gcoHAL_Destroy(ingenic_2d->g_hal);
gcoOS_Destroy(ingenic_2d->g_os);
}
/*---------------------------------------------------------------------------------------------------------------------------------*/
struct ingenic_2d *ingenic_2d_open(void)
{
int ret;
struct ingenic_2d *ingenic_2d = malloc(sizeof(*ingenic_2d));
if (!ingenic_2d) {
fprintf(stderr, "failed to alloc g2d handle\n");
return NULL;
}
ret = g2d_driver_init(ingenic_2d);
if (ret < 0)
goto free_2d;
int rmem_fd = rmem_open();
if (rmem_fd < 0) {
fprintf(stderr, "ingenic_2d: failed to open, rmem open err\n");
goto deinit_2d;
}
ingenic_2d->rmem_fd = rmem_fd;
return ingenic_2d;
deinit_2d:
g2d_deinit(ingenic_2d);
free_2d:
free(ingenic_2d);
return NULL;
}
void ingenic_2d_close(struct ingenic_2d *ingenic_2d)
{
g2d_deinit(ingenic_2d);
rmem_close(ingenic_2d->rmem_fd);
free(ingenic_2d);
}
struct ingenic_2d_frame *ingenic_2d_alloc_frame(struct ingenic_2d *ingenic_2d, int width, int height,
enum ingenic_2d_format format)
{
struct g2d_frame *frame = malloc(sizeof(*frame));
if (!frame) {
fprintf(stderr, "ingenic_2d :failed to alloc 2d frame\n");
return NULL;
}
int ret = init_frame_info(ingenic_2d, frame, width, height, format);
if (ret < 0) {
goto free_frame;
}
ret = get_frame_buffer(ingenic_2d, frame);
if (ret < 0)
goto deinit_frame;
return &frame->frame;
deinit_frame:
deinit_frame_info(frame);
free_frame:
free(frame);
return NULL;
}
void ingenic_2d_free_frame(struct ingenic_2d *ingenic_2d, struct ingenic_2d_frame *frame)
{
struct g2d_frame *g2d_frame = (struct g2d_frame *)frame;
put_frame_buffer(ingenic_2d, g2d_frame);
deinit_frame_info(g2d_frame);
free(g2d_frame);
}
struct ingenic_2d_frame *ingenic_2d_alloc_frame_by_user(struct ingenic_2d *ingenic_2d,
int width, int height,enum ingenic_2d_format format,
unsigned long phyaddr, void *addr, int addrsize)
{
struct g2d_frame *frame = malloc(sizeof(*frame));
if (!frame) {
fprintf(stderr, "ingenic_2d :failed to alloc 2d frame\n");
return NULL;
}
int ret = init_frame_info(ingenic_2d, frame, width, height, format);
if (ret < 0) {
goto free_frame;
}
ret = set_frame_buffer_by_user(frame, phyaddr, addr, addrsize);
if (ret < 0)
goto deinit_frame;
return &frame->frame;
deinit_frame:
deinit_frame_info(frame);
free_frame:
free(frame);
return NULL;
}
struct ingenic_2d_rect ingenic_2d_rect_init(struct ingenic_2d_frame *frame, int x, int y, int w, int h)
{
struct ingenic_2d_rect rect;
rect.frame = frame;
rect.x = x < 0 ? 0 : x;
rect.y = y < 0 ? 0 : y;
rect.w = w < 0 ? frame->width : w;
rect.h = h < 0 ? frame->height : h;
if (x + w > frame->width)
rect.w = frame->width - x;
if (y + h > frame->height)
rect.h = frame->height - y;
return rect;
}
int ingenic_2d_rotate(struct ingenic_2d *ingenic_2d, enum ingenic_2d_rotate_angle angle,
struct ingenic_2d_rect *src,struct ingenic_2d_rect *dst)
{
int ret;
struct ingenic_2d_frame *s_frame = src->frame;
struct ingenic_2d_frame *d_frame = dst->frame;
gceSURF_FORMAT s_format = ingenic_format_to_2d_format(s_frame->format);
if (s_format < 0)
return -1;
gceSURF_FORMAT d_format = ingenic_format_to_2d_format(d_frame->format);
if (d_format < 0)
return -1;
gcsRECT src_rect = {0};
gcsRECT dst_rect = {0};
to_2d_rect(src, &src_rect);
to_2d_rect(dst, &dst_rect);
ret = gco2D_SetKernelSize(ingenic_2d->g_2d, 9, 9);
if (ret < 0) {
fprintf(stderr, "ingenic_2d: 2d set kernel size failed\n");
return -1;
}
ret = gco2D_SetColorSource(ingenic_2d->g_2d, s_frame->phyaddr[0],
s_frame->stride,
s_format,
gcvSURF_0_DEGREE,
s_frame->align_width,
gcvFALSE,
gcvSURF_OPAQUE,
0);
if (ret < 0) {
fprintf(stderr, "ingenic_2d: 2d set colorsource failed\n");
return -1;
}
ret = gco2D_SetSource(ingenic_2d->g_2d, &src_rect);
if (ret < 0) {
fprintf(stderr, "inegnic_2d: 2d set source range failed\n");
return -1;
}
ret = gco2D_SetClipping(ingenic_2d->g_2d, &src_rect);
if (ret < 0) {
fprintf(stderr, "ingenic_2d: 2d set clipping failed\n");
return -1;
}
ret = gco2D_SetTargetEx(ingenic_2d->g_2d, d_frame->phyaddr[0],
d_frame->stride,
angle,
d_frame->align_width,
d_frame->align_height);
if (ret < 0) {
fprintf(stderr, "inengic_2d: 2d set target failed\n");
return -1;
}
struct g2d_frame *gs_frame = (struct g2d_frame *)s_frame;
struct g2d_frame *gd_frame = (struct g2d_frame *)d_frame;
ret = gcoSURF_FilterBlit(gs_frame->surf, gd_frame->surf, &src_rect, &dst_rect, NULL);
if (ret < 0) {
fprintf(stderr, "ingenic_2d: failed to rotater, filter blit err\n");
return -1;
}
return ingenic_2d_work_out(ingenic_2d, gs_frame, gd_frame);
}
int ingenic_2d_scale(struct ingenic_2d *ingenic_2d, struct ingenic_2d_rect *src, struct ingenic_2d_rect *dst)
{
int ret;
struct ingenic_2d_frame *s_frame = src->frame;
struct ingenic_2d_frame *d_frame = dst->frame;
gceSURF_FORMAT s_format = ingenic_format_to_2d_format(s_frame->format);
if (s_format < 0)
return -1;
gceSURF_FORMAT d_format = ingenic_format_to_2d_format(d_frame->format);
if (d_format < 0)
return -1;
gcsRECT src_rect = {0};
gcsRECT dst_rect = {0};
to_2d_rect(src, &src_rect);
to_2d_rect(dst, &dst_rect);
ret = gco2D_SetClipping(ingenic_2d->g_2d, &src_rect);
if (ret < 0) {
fprintf(stderr, "ingenic_2d: failed to scale, set clipping err\n");
return -1;
}
ret = gco2D_SetKernelSize(ingenic_2d->g_2d, 1, 1);
if (ret < 0) {
fprintf(stderr, "ingenic_2d: failed to scale, set kernel size err\n");
return -1;
}
struct g2d_frame *gs_frame = (struct g2d_frame *)s_frame;
struct g2d_frame *gd_frame = (struct g2d_frame *)d_frame;
ret = gcoSURF_FilterBlit(gs_frame->surf, gd_frame->surf, &src_rect, &dst_rect, NULL);
if (ret < 0) {
fprintf(stderr, "ingenic_2d: failed to scale, filter blit err\n");
return -1;
}
return ingenic_2d_work_out(ingenic_2d, gs_frame, gd_frame);
}
int ingenic_2d_fill_rect(struct ingenic_2d *ingenic_2d, struct ingenic_2d_rect *dst, int color)
{
int ret;
struct ingenic_2d_frame *d_frame = dst->frame;
gceSURF_FORMAT d_format = ingenic_format_to_2d_format(d_frame->format);
if (d_format < 0)
return -1;
gcsRECT dst_rect = {0};
to_2d_rect(dst, &dst_rect);
gcoBRUSH bgBrush;
ret = gco2D_ConstructSingleColorBrush(ingenic_2d->g_2d, 1, color, 0, &bgBrush);
if (ret < 0) {
fprintf(stderr, "ingenic_2d: failed to fill, construct single color err\n");
return -1;
}
ret = gco2D_FlushBrush(ingenic_2d->g_2d, bgBrush, d_format);
if (ret < 0) {
fprintf(stderr, "ingenic_2d: failed to fill, flush brush err\n");
return -1;
}
ret = gco2D_SetTarget(ingenic_2d->g_2d, d_frame->phyaddr[0], d_frame->stride, 0, d_frame->width);
if (ret < 0) {
fprintf(stderr, "ingenic_2d: failed to fill, set target err\n");
return -1;
}
ret = gco2D_SetClipping(ingenic_2d->g_2d, &dst_rect);
if (ret < 0) {
fprintf(stderr, "ingenic_2d: failed to fill, set clipping err\n");
return -1;
}
ret = gco2D_Blit(ingenic_2d->g_2d, 1, &dst_rect, 0xF0, 0xF0, d_format);
if (ret < 0) {
fprintf(stderr, "ingenic_2d: failed to fill, blit err\n");
}
gcoBRUSH_Destroy(bgBrush);
return ingenic_2d_work_out(ingenic_2d, NULL, (struct g2d_frame *)d_frame);
}
int ingenic_2d_blend(struct ingenic_2d *ingenic_2d,
struct ingenic_2d_rect *src, struct ingenic_2d_rect *dst, int global_alpha)
{
int ret;
struct ingenic_2d_frame *s_frame = src->frame;
struct ingenic_2d_frame *d_frame = dst->frame;
gceSURF_FORMAT s_format = ingenic_format_to_2d_format(s_frame->format);
if (s_format < 0)
return -1;
gceSURF_FORMAT d_format = ingenic_format_to_2d_format(d_frame->format);
if (d_format < 0)
return -1;
gcsRECT src_rect = {0};
gcsRECT dst_rect = {0};
to_2d_rect(src, &src_rect);
to_2d_rect(dst, &dst_rect);
int src_alpha = global_alpha;
if (global_alpha > 0xf8)
src_alpha = 0xff;
if (global_alpha < 0x08)
src_alpha = 0;
gco2D_SetKernelSize(ingenic_2d->g_2d, 9, 9);
ret = gco2D_EnableAlphaBlend(ingenic_2d->g_2d,
src_alpha, 0xff,
gcvSURF_PIXEL_ALPHA_STRAIGHT, gcvSURF_PIXEL_ALPHA_STRAIGHT,
gcvSURF_GLOBAL_ALPHA_SCALE, gcvSURF_GLOBAL_ALPHA_SCALE,
gcvSURF_BLEND_ONE, gcvSURF_BLEND_INVERSED,
gcvSURF_COLOR_STRAIGHT, gcvSURF_COLOR_STRAIGHT);
if (ret < 0) {
fprintf(stderr, "ingenic_2d: failed to enable alpha blend\n");
return -1;
}
ret = gco2D_SetColorSource(ingenic_2d->g_2d, s_frame->phyaddr[0],
s_frame->stride,
s_format,
gcvSURF_0_DEGREE,
s_frame->align_width,
gcvFALSE,
gcvSURF_OPAQUE,
0);
if (ret < 0) {
fprintf(stderr, "ingenic_2d: failed to blend, set colorsource err\n");
return -1;
}
ret = gco2D_SetSource(ingenic_2d->g_2d, &src_rect);
if (ret < 0) {
fprintf(stderr, "ingenic_2d: failed to blend, set sourc err\n");
return -1;
}
ret = gco2D_SetClipping(ingenic_2d->g_2d, &dst_rect);
if (ret < 0) {
fprintf(stderr, "ingenic_2d: failed to blend, set clipping err\n");
return -1;
}
ret = gco2D_SetTarget(ingenic_2d->g_2d, d_frame->phyaddr[0], d_frame->stride,
gcvFALSE, d_frame->align_width);
if (ret < 0) {
fprintf(stderr, "ingenic_2d: failed to blend, failed to set target\n");
return -1;
}
ret = gco2D_Blit(ingenic_2d->g_2d, 1, &dst_rect, 0xCC, 0xCC, d_format);
if (ret < 0) {
fprintf(stderr, "ingenic_2d: failed to blend, blit err\n");
return -1;
}
ret = ingenic_2d_work_out(ingenic_2d, (struct g2d_frame *)s_frame, (struct g2d_frame *)d_frame);
gco2D_DisableAlphaBlend(ingenic_2d->g_2d);
return ret;
}
int ingenic_2d_draw_lines(struct ingenic_2d *ingenic_2d,
struct ingenic_2d_rect *dst,
struct ingenic_2d_line *lines, int line_count, int line_color)
{
int ret;
struct ingenic_2d_frame *d_frame = dst->frame;
gceSURF_FORMAT d_format = ingenic_format_to_2d_format(d_frame->format);
if (d_format < 0)
return -1;
gcsRECT dst_rect = {0};
to_2d_rect(dst, &dst_rect);
ret = gco2D_SetClipping(ingenic_2d->g_2d, &dst_rect);
if (ret < 0) {
fprintf(stderr, "ingenic_2d: failed to draw lines, set clipping err\n");
return -1;
}
ret = gco2D_SetTarget(ingenic_2d->g_2d, d_frame->phyaddr[0], d_frame->stride, gcvSURF_0_DEGREE, d_frame->align_width);
if (ret < 0) {
fprintf(stderr, "ingenic_2d: failed to draw lines, set target err\n");
return -1;
}
ret = gco2D_ColorLine(ingenic_2d->g_2d, line_count, (gcsRECT *)lines, line_color, 0xCC, 0xCC, d_format);
if (ret < 0) {
fprintf(stderr, "ingenic 2d: failed to draw lines, color line err\n");
return -1;
}
return ingenic_2d_work_out(ingenic_2d, NULL, (struct g2d_frame *)d_frame);
}
int ingenic_2d_filp(struct ingenic_2d *ingenic_2d,
struct ingenic_2d_rect *src,
struct ingenic_2d_rect *dst, int x_filp, int y_filp)
{
int ret;
struct ingenic_2d_frame *s_frame = src->frame;
struct ingenic_2d_frame *d_frame = dst->frame;
gceSURF_FORMAT s_format = ingenic_format_to_2d_format(s_frame->format);
if (s_format < 0)
return -1;
gceSURF_FORMAT d_format = ingenic_format_to_2d_format(d_frame->format);
if (d_format < 0)
return -1;
gcsRECT src_rect = {0};
gcsRECT dst_rect = {0};
to_2d_rect(src, &src_rect);
to_2d_rect(dst, &dst_rect);
ret = gco2D_SetColorSource(ingenic_2d->g_2d, s_frame->phyaddr[0],
s_frame->stride,
s_format,
gcvSURF_0_DEGREE,
s_frame->align_width,
gcvFALSE,
gcvSURF_OPAQUE,
0);
if (ret < 0) {
fprintf(stderr, "ingenic_2d: failed to filp, set color source err\n");
return ret;
}
ret = gco2D_SetKernelSize(ingenic_2d->g_2d, 9, 9);
if (ret < 0) {
fprintf(stderr, "ingenic_2d: failed to filp, set kernel size err\n");
return -1;
}
ret = gco2D_SetSource(ingenic_2d->g_2d, &src_rect);
if (ret < 0) {
fprintf(stderr, "ingenic_2d :failed to filp, set source rect err\n");
return -1;
}
ret = gco2D_SetClipping(ingenic_2d->g_2d, &dst_rect);
if (ret < 0) {
fprintf(stderr, "ingenic_2d: failed to filp, set clipping err");
return -1;
}
ret = gco2D_SetTargetEx(ingenic_2d->g_2d, d_frame->phyaddr[0],
d_frame->stride,
gcvSURF_0_DEGREE,
d_frame->align_width,
d_frame->align_height);
if (ret < 0) {
fprintf(stderr, "ingenic_2d: failed to set filp, set targetex err\n");
return -1;
}
ret = gco2D_SetBitBlitMirror(ingenic_2d->g_2d, x_filp, y_filp);
if (ret < 0 ) {
fprintf(stderr, "ingenic_2d: failed to filp, set blit mirror err");
return -1;
}
ret = gco2D_Blit(ingenic_2d->g_2d, 1, &dst_rect, 0xCC, 0xCC, d_format);
if (ret < 0) {
fprintf(stderr, "ingenic_2d: failed to filp, blit err\n");
return -1;
}
ret = gco2D_SetBitBlitMirror(ingenic_2d->g_2d, 0, 0);
if (ret < 0 ) {
fprintf(stderr, "ingenic_2d: failed to filp, set blit mirror err");
return -1;
}
return ingenic_2d_work_out(ingenic_2d, (struct g2d_frame *)s_frame, (struct g2d_frame *)d_frame);
}
int ingenic_2d_convert(struct ingenic_2d *ingenic_2d, struct ingenic_2d_rect *src, struct ingenic_2d_rect *dst)
{
int ret;
struct ingenic_2d_frame *s_frame = src->frame;
struct ingenic_2d_frame *d_frame = dst->frame;
gceSURF_FORMAT s_format = ingenic_format_to_2d_format(s_frame->format);
if (s_format < 0)
return -1;
gceSURF_FORMAT d_format = ingenic_format_to_2d_format(d_frame->format);
if (d_format < 0)
return -1;
gcsRECT src_rect = {0};
gcsRECT dst_rect = {0};
to_2d_rect(src, &src_rect);
to_2d_rect(dst, &dst_rect);
ret = gco2D_SetClipping(ingenic_2d->g_2d, &dst_rect);
if (ret < 0) {
fprintf(stderr, "ingenic_2d: failed to convert, set clipping err\n");
return -1;
}
ret = gco2D_SetKernelSize(ingenic_2d->g_2d, 1, 1);
if (ret < 0) {
fprintf(stderr, "ingenic_2d: failed to convert, set kernel size err\n");
return -1;
}
struct g2d_frame *gs_frame = (struct g2d_frame *)s_frame;
struct g2d_frame *gd_frame = (struct g2d_frame *)d_frame;
ret = gcoSURF_FilterBlit(gs_frame->surf, gd_frame->surf, &src_rect, &dst_rect, NULL);
if (ret < 0) {
fprintf(stderr, "ingenic_2d: failed to convert, filter blit err\n");
return -1;
}
return ingenic_2d_work_out(ingenic_2d, gs_frame, gd_frame);
}

View File

@ -1,593 +0,0 @@
/****************************************************************************
*
* Copyright (c) 2005 - 2010 by Vivante Corp. All rights reserved.
*
* The material in this file is confidential and contains trade secrets
* of Vivante Corporation. This is proprietary information owned by
* Vivante Corporation. No part of this work may be disclosed,
* reproduced, copied, transmitted, or used in any way for any purpose,
* without the express written permission of Vivante Corporation.
*
*****************************************************************************
*
* Auto-generated file on 11/10/2010. Do not edit!!!
*
*****************************************************************************/
/**
** @file
** Debug code for hal user layers.
**
*/
#include "gc_hal_user_linux.h"
#include <stdlib.h>
/* Include this if you want to print thread IDs as well. */
/*#include <pthread.h>*/
/******************************************************************************\
******************************** Debug Variables *******************************
\******************************************************************************/
static gceSTATUS _lastError = gcvSTATUS_OK;
static gctUINT32 _debugLevel = gcvLEVEL_ERROR;
static gctUINT32 _debugZones[16];
static FILE * _debugFile;
static FILE * _debugFileVS;
static FILE * _debugFileFS;
static gctUINT32 _shaderFileType;
static int _indent;
#define gcdBUFFER_SIZE 0
#if gcdBUFFER_SIZE
static unsigned char _buffer[gcdBUFFER_SIZE];
static unsigned long _bytes;
#endif
static void _Flush(
IN gctFILE File
)
{
#if gcdBUFFER_SIZE
if (_bytes > 0)
{
fwrite(_buffer, _bytes, 1, (File == NULL) ? stderr : File);
_bytes = 0;
}
#endif
}
static void
_Print(
IN gctFILE File,
IN gctCONST_STRING Message,
IN va_list Arguments
)
{
static char buffer[256];
int n, i;
/* Test for level decrease. */
if (strncmp(Message, "--", 2) == 0)
{
_indent -= 2;
}
#ifdef PTHREAD_ONCE_INIT
i = snprintf(buffer, sizeof(buffer), "%08lx: ", pthread_self());
#else
i = 0;
#endif
/* Indent message. */
for (n = i + _indent; i < n; ++i)
{
buffer[i] = ' ';
}
/* Print message to buffer. */
n = vsnprintf(buffer + i, sizeof(buffer) - i, Message, Arguments);
if ((n <= 0) || (buffer[i + n - 1] != '\n'))
{
/* Append new-line. */
strncat(buffer, "\n", sizeof(buffer));
}
/* Output to file or debugger. */
#if gcdBUFFER_SIZE
n = strlen(buffer);
if (_bytes + n > gcdBUFFER_SIZE)
{
_Flush(File);
}
memcpy(_buffer + _bytes, buffer, n);
_bytes += n;
#else
fprintf((File == gcvNULL) ? stderr : File, buffer);
#endif
/* Test for level increase. */
if (strncmp(Message, "++", 2) == 0)
{
_indent += 2;
}
}
/******************************************************************************\
********************************* Debug Macros *********************************
\******************************************************************************/
#define gcmDEBUGPRINT(FileHandle, Message) \
{ \
va_list arguments; \
\
va_start(arguments, Message); \
_Print(FileHandle, Message, arguments); \
va_end(arguments); \
}
/******************************************************************************\
********************************** Debug Code **********************************
\******************************************************************************/
/*******************************************************************************
**
** gcoOS_Print
**
** Print a message.
**
** INPUT:
**
** gctSTRING Message
** Pointer to message.
**
** ...
** Optional arguments.
*/
void
gcoOS_Print(
IN gctCONST_STRING Message,
...
)
{
gcmDEBUGPRINT(_debugFile, Message);
}
/*******************************************************************************
**
** gcoOS_DebugTrace
**
** Send a leveled message to the debugger.
**
** INPUT:
**
** gctUINT32 Level
** Debug level of message.
**
** gctCONST_STRING Message
** Pointer to message.
**
** ...
** Optional arguments.
**
** OUTPUT:
**
** Nothing.
*/
void
gcoOS_DebugTrace(
IN gctUINT32 Level,
IN gctCONST_STRING Message,
...
)
{
if (Level > _debugLevel)
{
return;
}
gcmDEBUGPRINT(_debugFile, Message);
}
/*******************************************************************************
**
** gcoOS_DebugTraceZone
**
** Send a leveled and zoned message to the debugger.
**
** INPUT:
**
** gctUINT32 Level
** Debug level for message.
**
** gctUINT32 Zone
** Debug zone for message.
**
** gctCONST_STRING Message
** Pointer to message.
**
** ...
** Optional arguments.
**
** OUTPUT:
**
** Nothing.
*/
void
gcoOS_DebugTraceZone(
IN gctUINT32 Level,
IN gctUINT32 Zone,
IN gctCONST_STRING Message,
...
)
{
/* Verify that the debug level and zone are valid. */
if ((Level > _debugLevel)
|| !(_debugZones[gcmZONE_GET_API(Zone)] & Zone & gcdZONE_MASK)
)
{
return;
}
gcmDEBUGPRINT(_debugFile, Message);
}
/*******************************************************************************
**
** gcoOS_DebugBreak
**
** Break into the debugger.
**
** INPUT:
**
** Nothing.
**
** OUTPUT:
**
** Nothing.
*/
void
gcoOS_DebugBreak(
void
)
{
gcmTRACE(gcvLEVEL_ERROR, "%s(%d)", __FUNCTION__, __LINE__);
}
/*******************************************************************************
**
** gcoOS_DebugFatal
**
** Send a message to the debugger and break into the debugger.
**
** INPUT:
**
** gctCONST_STRING Message
** Pointer to message.
**
** ...
** Optional arguments.
**
** OUTPUT:
**
** Nothing.
*/
void
gcoOS_DebugFatal(
IN gctCONST_STRING Message,
...
)
{
gcmDEBUGPRINT(_debugFile, Message);
/* Break into the debugger. */
gcoOS_DebugBreak();
}
/*******************************************************************************
**
** gcoOS_SetDebugLevel
**
** Set the debug level.
**
** INPUT:
**
** gctUINT32 Level
** New debug level.
**
** OUTPUT:
**
** Nothing.
*/
void
gcoOS_SetDebugLevel(
IN gctUINT32 Level
)
{
_debugLevel = Level;
}
/*******************************************************************************
**
** gcoOS_SetDebugZone
**
** Set the debug zone.
**
** INPUT:
**
** gctUINT32 Zone
** New debug zone.
**
** OUTPUT:
**
** Nothing.
*/
void
gcoOS_SetDebugZone(
IN gctUINT32 Zone
)
{
_debugZones[gcmZONE_GET_API(Zone)] = Zone;
}
/*******************************************************************************
**
** gcoOS_SetDebugLevelZone
**
** Set the debug level and zone.
**
** INPUT:
**
** gctUINT32 Level
** New debug level.
**
** gctUINT32 Zone
** New debug zone.
**
** OUTPUT:
**
** Nothing.
*/
void
gcoOS_SetDebugLevelZone(
IN gctUINT32 Level,
IN gctUINT32 Zone
)
{
_debugLevel = Level;
_debugZones[gcmZONE_GET_API(Zone)] = Zone;
}
/*******************************************************************************
**
** gcoOS_SetDebugZones
**
** Enable or disable debug zones.
**
** INPUT:
**
** gctBOOL Enable
** Set to gcvTRUE to enable the zones (or the Zones with the current
** zones) or gcvFALSE to disable the specified Zones.
**
** gctUINT32 Zones
** Debug zones to enable or disable.
**
** OUTPUT:
**
** Nothing.
*/
void
gcoOS_SetDebugZones(
IN gctUINT32 Zones,
IN gctBOOL Enable
)
{
if (Enable)
{
/* Enable the zones. */
_debugZones[gcmZONE_GET_API(Zones)] |= Zones;
}
else
{
/* Disable the zones. */
_debugZones[gcmZONE_GET_API(Zones)] &= ~Zones;
}
}
/*******************************************************************************
**
** gcoOS_Verify
**
** Called to verify the result of a function call.
**
** INPUT:
**
** gceSTATUS Status
** Function call result.
**
** OUTPUT:
**
** Nothing.
*/
void
gcoOS_Verify(
IN gceSTATUS Status
)
{
_lastError = Status;
}
/*******************************************************************************
**
** gcoOS_SetDebugFile
**
** Open or close the debug file.
**
** INPUT:
**
** gcoOS Os
** Pointer to gcoOS object.
**
** gctCONST_STRING FileName
** Name of debug file to open or gcvNULL to close the current debug
** file.
**
** OUTPUT:
**
** Nothing.
*/
void
gcoOS_SetDebugFile(
IN gctCONST_STRING FileName
)
{
_Flush(_debugFile);
/* Close any existing file handle. */
if (_debugFile != gcvNULL)
{
fclose(_debugFile);
_debugFile = gcvNULL;
}
if (FileName != gcvNULL)
{
_debugFile = fopen(FileName, "w");
}
}
/*******************************************************************************
**
** gcoOS_SetDebugShaderFiles
**
** Called to redirect shader debug output to file(s).
** Passing gcvNULL argument closes previously open file handles.
**
** INPUT:
**
** gctCONST_STRING VSFileName
** Vertex Shader Filename.
**
** gctCONST_STRING FSFileName
** Fragment Shader Filename.
**
** OUTPUT:
**
** Nothing.
*/
void
gcoOS_SetDebugShaderFiles(
IN gctCONST_STRING VSFileName,
IN gctCONST_STRING FSFileName
)
{
if (_debugFileVS != gcvNULL)
{
fclose(_debugFileVS);
_debugFileVS = gcvNULL;
}
if (_debugFileFS != gcvNULL)
{
fclose(_debugFileFS);
_debugFileFS = gcvNULL;
}
if (VSFileName != gcvNULL)
{
_debugFileVS = fopen(VSFileName, "w");
}
if (FSFileName != gcvNULL)
{
_debugFileFS = fopen(FSFileName, "w");
}
}
/*******************************************************************************
**
** gcoOS_SetDebugShaderFileType
**
** Called to set debugging output to vertex/fragment shader file.
**
** INPUT:
**
** gctUINT32 ShaderType
** 0 for Vertex Shader, 1 for Fragment Shader.
**
** OUTPUT:
**
** Nothing.
*/
void
gcoOS_SetDebugShaderFileType(
IN gctUINT32 ShaderType
)
{
if (ShaderType <= 1)
{
_shaderFileType = ShaderType;
}
}
/*******************************************************************************
**
** gcoOS_DebugShaderTrace
**
** Dump a message to a shader file.
**
** INPUT:
**
** gctCONST_STRING Message
** Pointer to message.
**
** ...
** Optional arguments.
**
** OUTPUT:
**
** Nothing.
*/
void
gcoOS_DebugShaderTrace(
IN gctCONST_STRING Message,
...
)
{
FILE * file;
/* Verify that the shader file handle is valid. */
if (_shaderFileType && (_debugFileFS != gcvNULL))
{
file = _debugFileFS;
}
else if (!_shaderFileType && (_debugFileVS != gcvNULL))
{
file = _debugFileVS;
}
else
{
return;
}
gcmDEBUGPRINT(file, Message);
}

View File

@ -1,33 +0,0 @@
/****************************************************************************
*
* Copyright (c) 2005 - 2010 by Vivante Corp. All rights reserved.
*
* The material in this file is confidential and contains trade secrets
* of Vivante Corporation. This is proprietary information owned by
* Vivante Corporation. No part of this work may be disclosed,
* reproduced, copied, transmitted, or used in any way for any purpose,
* without the express written permission of Vivante Corporation.
*
*****************************************************************************
*
* Auto-generated file on 11/10/2010. Do not edit!!!
*
*****************************************************************************/
#ifndef __gc_hal_user_linux_h_
#define __gc_hal_user_linux_h_
#define _ISOC99_SOURCE
#define _XOPEN_SOURCE 501
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include "gc_hal_user.h"
#endif /* __gc_hal_user_linux_h_ */

View File

@ -1,155 +0,0 @@
/****************************************************************************
*
* Copyright (c) 2005 - 2010 by Vivante Corp. All rights reserved.
*
* The material in this file is confidential and contains trade secrets
* of Vivante Corporation. This is proprietary information owned by
* Vivante Corporation. No part of this work may be disclosed,
* reproduced, copied, transmitted, or used in any way for any purpose,
* without the express written permission of Vivante Corporation.
*
*****************************************************************************
*
* Auto-generated file on 11/10/2010. Do not edit!!!
*
*****************************************************************************/
#include "gc_hal_user_linux.h"
#include <math.h>
gctUINT32
gcoMATH_Log2in5dot5(
IN gctINT X
)
{
return (X > 0)
? (gctUINT32) (logf(X) / logf(2.0f) * 32.0f)
: 0;
}
gctFLOAT
gcoMATH_Sine(
IN gctFLOAT X
)
{
return sinf(X);
}
gctFLOAT
gcoMATH_Cosine(
IN gctFLOAT X
)
{
return cosf(X);
}
gctFLOAT
gcoMATH_Floor(
IN gctFLOAT X
)
{
return floorf(X);
}
gctFLOAT
gcoMATH_Ceiling(
IN gctFLOAT X
)
{
return ceilf(X);
}
gctFLOAT
gcoMATH_SquareRoot(
IN gctFLOAT X
)
{
return sqrtf(X);
}
gctFLOAT
gcoMATH_Log2(
IN gctFLOAT X
)
{
return logf(X) / logf(2.0f);
}
gctFLOAT
gcoMATH_Power(
IN gctFLOAT X,
IN gctFLOAT Y
)
{
return powf(X, Y);
}
gctFLOAT
gcoMATH_Modulo(
IN gctFLOAT X,
IN gctFLOAT Y
)
{
return fmodf(X, Y);
}
gctFLOAT
gcoMATH_Exp(
IN gctFLOAT X
)
{
return expf(X);
}
gctFLOAT
gcoMATH_Absolute(
IN gctFLOAT X
)
{
return fabsf(X);
}
gctFLOAT
gcoMATH_ArcCosine(
IN gctFLOAT X
)
{
return acosf(X);
}
gctFLOAT
gcoMATH_Tangent(
IN gctFLOAT X
)
{
return tanf(X);
}
gctFLOAT
gcoMATH_UInt2Float(
IN gctUINT X
)
{
return (gctFLOAT) X;
}
gctUINT
gcoMATH_Float2UInt(
IN gctFLOAT X
)
{
return (gctUINT) X;
}
gctFLOAT
gcoMATH_Multiply(
IN gctFLOAT X,
IN gctFLOAT Y
)
{
return X * Y;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,990 +0,0 @@
/****************************************************************************
*
* Copyright (c) 2005 - 2010 by Vivante Corp. All rights reserved.
*
* The material in this file is confidential and contains trade secrets
* of Vivante Corporation. This is proprietary information owned by
* Vivante Corporation. No part of this work may be disclosed,
* reproduced, copied, transmitted, or used in any way for any purpose,
* without the express written permission of Vivante Corporation.
*
*****************************************************************************
*
* Auto-generated file on 11/10/2010. Do not edit!!!
*
*****************************************************************************/
/**
** @file
** gcoBRUSH object for user HAL layers.
**
*/
#include "gc_hal_user_precomp.h"
#include "gc_hal_user_brush.h"
/* Zone used for header/footer. */
#define _GC_OBJ_ZONE gcvZONE_2D
/******************************************************************************\
********************************** Structures **********************************
\******************************************************************************/
enum
{
BRUSH_MAX_DATA_SIZE = (10 + 64) * 4
};
struct _gcoBRUSH
{
/* Object. */
gcsOBJECT object;
/* Pointer to an gcoHAL object. */
gcoHAL hal;
/* Pointer to an gco2D object. */
gco2D engine;
/* Pattern attributes. */
gceSURF_FORMAT format;
/* Pattern origin. */
gctUINT32 originX;
gctUINT32 originY;
/* Color attributes. */
gctUINT32 colorConvert;
gctUINT32 fgColor;
gctUINT32 bgColor;
/* Mono pattern value and mask. */
gctUINT64 monoBits;
gctPOINTER colorBits;
gctUINT32 colorSize;
gctUINT64 mask;
};
/******************************************************************************\
********************************* Support Code *********************************
\******************************************************************************/
/*******************************************************************************
**
** _BuildBrushBuffer
**
** Returns a buffer filled with complete set of brush parameters.
**
** INPUT:
**
** gcoHAL Hal
** Pointer to an gcoHAL object.
**
** gceSURF_FORMAT Format
** gctUINT32 OriginX
** gctUINT32 OriginY
** gctUINT32 ColorConvert
** gctUINT32 FgColor
** gctUINT32 BgColor
** gctUINT64 MonoBits
** gctPOINTER ColorBits
** gctUINT64 Mask
** Brush parameters described in the ConstructXXX functions below.
**
** OUTPUT:
**
** gctUINT8 * BrushData
** Brush data buffer.
**
** gctUINT32 * DataCount
** Number of bytes in the brush data array.
*/
static gceSTATUS _BuildBrushBuffer(
IN gcoHARDWARE Hardware,
IN gceSURF_FORMAT Format,
IN gctUINT32 OriginX,
IN gctUINT32 OriginY,
IN gctUINT32 ColorConvert,
IN gctUINT32 FgColor,
IN gctUINT32 BgColor,
IN gctUINT64 MonoBits,
IN gctPOINTER ColorBits,
IN gctUINT64 Mask,
IN OUT gctUINT8 * BrushData,
IN OUT gctUINT32 * DataCount
)
{
gceSTATUS status;
gctUINT32 i, index;
gctUINT32 * brushData;
gctUINT32 bitsPerPixel;
gctUINT32 size8, size32;
gctUINT64 tempBits;
/* Check parameters. */
if ((BrushData == gcvNULL) ||
(*DataCount < BRUSH_MAX_DATA_SIZE))
{
*DataCount = BRUSH_MAX_DATA_SIZE;
return gcvSTATUS_MORE_DATA;
}
/* Init the buffer parameters. */
index = 0;
brushData = (gctUINT32*) BrushData;
/* Fill in the buffer with brush parameters. */
brushData[index++] = Format; /* 1 */
brushData[index++] = OriginX; /* 2 */
brushData[index++] = OriginY; /* 3 */
brushData[index++] = ColorConvert; /* 4 */
brushData[index++] = FgColor; /* 5 */
brushData[index++] = BgColor; /* 6 */
brushData[index++] = (gctUINT32)(MonoBits >> 32); /* 7 */
brushData[index++] = (gctUINT32)(MonoBits); /* 8 */
brushData[index++] = (gctUINT32)(Mask >> 32); /* 9 */
brushData[index++] = (gctUINT32)(Mask); /* 10 */
/* Fill in the brush color data based on the format. */
if (ColorBits != gcvNULL)
{
/*
Color brush.
*/
/* Compute bits per pixel. */
status = gcoHARDWARE_ConvertFormat(Hardware,
Format,
&bitsPerPixel,
gcvNULL);
if (status != gcvSTATUS_OK)
{
/* Error. */
return status;
}
/* Determine the size of the brush bitmap. */
size8 = bitsPerPixel * 8;
size32 = size8 / 4;
/* Copy brush bitmap. */
gcmVERIFY_OK(gcoOS_MemCopy(brushData + index, ColorBits, size8));
index += size32;
}
else if ((OriginX != ~0) && (OriginY != ~0))
{
/*
Monochrome brush.
*/
tempBits = MonoBits;
for (i = 0; i < 64; i++)
{
brushData[index++] = ((tempBits & 1) != 0)
? FgColor
: BgColor;
tempBits >>= 1;
}
}
else
{
/*
Solid color brush.
*/
for (i = 0; i < 64; i++)
{
brushData[index++] = FgColor;
}
}
/* Set the data size. */
*DataCount = index * 4;
/* Success. */
return gcvSTATUS_OK;
}
/*******************************************************************************
**
** _Construct
**
** Common brush constructor.
**
** INPUT:
**
** gcoHARDWARE Hardware,
** Pointer to an gcoHARDWARE object.
**
** gceSURF_FORMAT Format
** gctUINT32 OriginX
** gctUINT32 OriginY
** gctUINT32 ColorConvert
** gctUINT32 FgColor
** gctUINT32 BgColor
** gctUINT64 MonoBits
** gctPOINTER ColorBits
** gctUINT64 Mask
** Brush parameters described in the ConstructXXX functions below.
**
** OUTPUT:
**
** gcoBRUSH * Brush
** Initialized gcoBRUSH object if successful.
*/
static gceSTATUS _Construct(
IN gcoHAL Hal,
IN gceSURF_FORMAT Format,
IN gctUINT32 OriginX,
IN gctUINT32 OriginY,
IN gctUINT32 ColorConvert,
IN gctUINT32 FgColor,
IN gctUINT32 BgColor,
IN gctUINT64 MonoBits,
IN gctUINT32 * ColorBits,
IN gctUINT64 Mask,
gcoBRUSH * Brush
)
{
gcoHARDWARE hardware;
gcoOS os;
gco2D engine;
gceSTATUS status;
gcoBRUSH_CACHE brushCache;
gcoBRUSH brush;
gctUINT8 brushData[BRUSH_MAX_DATA_SIZE];
gctUINT32 dataSize;
gctUINT32 * bitmap;
gctUINT32 bitsPerPixel;
gctUINT32 brushID;
/* Verify the arguments. */
gcmVERIFY_OBJECT(Hal, gcvOBJ_HAL);
/* Extract the gcoHARDWARE object pointer. */
hardware = Hal->hardware;
gcmVERIFY_OBJECT(hardware, gcvOBJ_HARDWARE);
/* Extract the gcoOS object pointer. */
os = Hal->os;
gcmVERIFY_OBJECT(os, gcvOBJ_OS);
/* Extract the gco2D object pointer. */
status = gcoHAL_Get2DEngine(Hal, &engine);
if (status < 0)
{
/* Error. */
return status;
}
/* Query the brush cache pointer. */
status = gco2D_GetBrushCache(engine, &brushCache);
if (status != gcvSTATUS_OK)
{
/* Error. */
return status;
}
gcmVERIFY_OBJECT(brushCache, gcvOBJ_BRUSHCACHE);
/* Build the data buffer. */
dataSize = sizeof(brushData);
status = _BuildBrushBuffer(hardware,
Format,
OriginX,
OriginY,
ColorConvert,
FgColor,
BgColor,
MonoBits,
ColorBits,
Mask,
brushData,
&dataSize);
if (status != gcvSTATUS_OK)
{
/* Error. */
return status;
}
/* Compute the brush ID. */
status = gcoBRUSH_CACHE_GetBrushID(brushCache,
brushData,
dataSize,
&brushID);
if (status != gcvSTATUS_OK)
{
/* Error. */
return status;
}
/* Attempt to find the matching brush. */
status = gcoBRUSH_CACHE_GetBrush(brushCache,
brushID,
brushData,
dataSize,
&brush);
if (status != gcvSTATUS_OK)
{
/* Error. */
return status;
}
/* If no matching brush found, create a new one. */
if (brush == gcvNULL)
{
/* Allocate the gcoBRUSH object. */
status = gcoOS_Allocate(os, sizeof(struct _gcoBRUSH), (gctPOINTER *) &brush);
if (status != gcvSTATUS_OK)
{
/* Error. */
return status;
}
/* Copy color bitmap if present. */
if (ColorBits == gcvNULL)
{
dataSize = 0;
bitmap = gcvNULL;
}
else
{
/* Compute bits per pixel. */
status = gcoHARDWARE_ConvertFormat(hardware,
Format,
&bitsPerPixel,
gcvNULL);
if (status != gcvSTATUS_OK)
{
/* Free the gcoBRUSH object. */
gcmVERIFY_OK(gcoOS_Free(os, brush));
/* Error. */
return status;
}
/* Determine the data size. */
dataSize = bitsPerPixel * 8;
/* Allocate the bitmap buffer. */
status = gcoOS_Allocate(os, dataSize, (gctPOINTER *) &bitmap);
if (status != gcvSTATUS_OK)
{
/* Free the gcoBRUSH object. */
gcmVERIFY_OK(gcoOS_Free(os, brush));
/* Error. */
return status;
}
/* Copy the bitmap. */
gcmVERIFY_OK(gcoOS_MemCopy(bitmap, ColorBits, dataSize));
}
/* Initialize the gcoBRUSH object.*/
brush->object.type = gcvOBJ_BRUSH;
brush->hal = Hal;
brush->engine = engine;
/* Set members. */
brush->colorSize = dataSize;
brush->format = Format;
brush->originX = OriginX;
brush->originY = OriginY;
brush->colorConvert = ColorConvert;
brush->fgColor = FgColor;
brush->bgColor = BgColor;
brush->monoBits = MonoBits;
brush->colorBits = bitmap;
brush->mask = Mask;
/* Add the brush to the cache. */
status = gcoBRUSH_CACHE_AddBrush(brushCache,
brush,
brushID,
(bitmap == gcvNULL) ? gcvFALSE : gcvTRUE);
if (status != gcvSTATUS_OK)
{
/* Free the brush. */
gcmVERIFY_OK(gcoBRUSH_Delete(brush));
/* Error. */
return status;
}
}
/* Return pointer to the gcoBRUSH object. */
*Brush = brush;
/* Success. */
return gcvSTATUS_OK;
}
/******************************************************************************\
******************************* gcoBRUSH API Code ******************************
\******************************************************************************/
/*******************************************************************************
**
** gcoBRUSH_ConstructSingleColor
**
** Create a new solid color gcoBRUSH object.
**
** INPUT:
**
** gcoHAL Hal
** Pointer to an gcoHAL object.
**
** gctUINT32 ColorConvert
** The value of the Color parameter is stored directly in internal
** color register and is used either directly to initialize pattern
** or is converted to the format of destination before it is used.
** The later happens if ColorConvert is not zero.
**
** gctUINT32 Color
** The color value of the pattern. The value will be used to
** initialize 8x8 pattern. If the value is in destination format,
** set ColorConvert to 0. Otherwise, provide the value in ARGB8
** format and set ColorConvert to 1 to instruct the hardware to
** convert the value to the destination format before it is
** actually used.
**
** gctUINT64 Mask
** 64 bits of mask, where each bit corresponds to one pixel of 8x8
** pattern. Each bit of the mask is used to determine transparency
** of the corresponding pixel, in other words, each mask bit is used
** to select between foreground or background ROPs. If the bit is 0,
** background ROP is used on the pixel; if 1, the foreground ROP
** is used. The mapping between Mask parameter bits and actual
** pattern pixels is as follows:
**
** +----+----+----+----+----+----+----+----+
** | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
** +----+----+----+----+----+----+----+----+
** | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 |
** +----+----+----+----+----+----+----+----+
** | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 |
** +----+----+----+----+----+----+----+----+
** | 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 |
** +----+----+----+----+----+----+----+----+
** | 39 | 38 | 37 | 36 | 35 | 34 | 33 | 32 |
** +----+----+----+----+----+----+----+----+
** | 47 | 46 | 45 | 44 | 43 | 42 | 41 | 40 |
** +----+----+----+----+----+----+----+----+
** | 55 | 54 | 53 | 52 | 51 | 50 | 49 | 48 |
** +----+----+----+----+----+----+----+----+
** | 63 | 62 | 61 | 60 | 59 | 58 | 57 | 56 |
** +----+----+----+----+----+----+----+----+
**
** OUTPUT:
**
** gcoBRUSH * Brush
** Pointer to the variable that will hold the gcoBRUSH object pointer.
*/
gceSTATUS
gcoBRUSH_ConstructSingleColor(
IN gcoHAL Hal,
IN gctUINT32 ColorConvert,
IN gctUINT32 Color,
IN gctUINT64 Mask,
gcoBRUSH * Brush
)
{
gceSTATUS status;
gcmHEADER_ARG("Hal=0x%x ColorConvert=%d Color=%x Mask=%llx Brush=0x%x",
Hal, ColorConvert, Color, Mask, Brush);
/* Verify the arguments. */
gcmVERIFY_OBJECT(Hal, gcvOBJ_HAL);
gcmVERIFY_ARGUMENT(ColorConvert <= 1);
gcmVERIFY_ARGUMENT(Brush != gcvNULL);
/* Create the brush. */
status = _Construct(Hal,
gcvSURF_A8R8G8B8,
~0U,
~0U,
ColorConvert,
Color,
Color,
0,
gcvNULL,
Mask,
Brush);
/* Return status. */
gcmFOOTER_ARG("*Brush=0x%x status=%d", *Brush, status);
return status;
}
/*******************************************************************************
**
** gcoBRUSH_ConstructMonochrome
**
** Create a new monochrome gcoBRUSH object.
**
** INPUT:
**
** gcoHAL Hal
** Pointer to an gcoHAL object.
**
** gctUINT32 OriginX
** gctUINT32 OriginY
** Specifies the origin of the pattern in 0..7 range.
**
** gctUINT32 ColorConvert
** The values of FgColor and BgColor parameters are stored directly in
** internal color registers and are used either directly to initialize
** pattern or converted to the format of destination before actually
** used. The later happens if ColorConvert is not zero.
**
** gctUINT32 FgColor
** gctUINT32 BgColor
** Foreground and background colors of the pattern. The values will be
** used to initialize 8x8 pattern. If the values are in destination
** format, set ColorConvert to 0. Otherwise, provide the values in
** ARGB8 format and set ColorConvert to 1 to instruct the hardware to
** convert the values to the destination format before they are
** actually used.
**
** gctUINT64 Bits
** 64 bits of pixel bits. Each bit represents one pixel and is used
** to choose between foreground and background colors. If the bit
** is 0, the background color is used; otherwise the foreground color
** is used. The mapping between Bits parameter and the actual pattern
** pixels is the same as of the Mask parameter.
**
** gctUINT64 Mask
** 64 bits of mask, where each bit corresponds to one pixel of 8x8
** pattern. Each bit of the mask is used to determine transparency
** of the corresponding pixel, in other words, each mask bit is used
** to select between foreground or background ROPs. If the bit is 0,
** background ROP is used on the pixel; if 1, the foreground ROP
** is used. The mapping between Mask parameter bits and the actual
** pattern pixels is as follows:
**
** +----+----+----+----+----+----+----+----+
** | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
** +----+----+----+----+----+----+----+----+
** | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 |
** +----+----+----+----+----+----+----+----+
** | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 |
** +----+----+----+----+----+----+----+----+
** | 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 |
** +----+----+----+----+----+----+----+----+
** | 39 | 38 | 37 | 36 | 35 | 34 | 33 | 32 |
** +----+----+----+----+----+----+----+----+
** | 47 | 46 | 45 | 44 | 43 | 42 | 41 | 40 |
** +----+----+----+----+----+----+----+----+
** | 55 | 54 | 53 | 52 | 51 | 50 | 49 | 48 |
** +----+----+----+----+----+----+----+----+
** | 63 | 62 | 61 | 60 | 59 | 58 | 57 | 56 |
** +----+----+----+----+----+----+----+----+
**
** OUTPUT:
**
** gcoBRUSH * Brush
** Pointer to the variable that will hold the gcoBRUSH object pointer.
*/
gceSTATUS
gcoBRUSH_ConstructMonochrome(
IN gcoHAL Hal,
IN gctUINT32 OriginX,
IN gctUINT32 OriginY,
IN gctUINT32 ColorConvert,
IN gctUINT32 FgColor,
IN gctUINT32 BgColor,
IN gctUINT64 Bits,
IN gctUINT64 Mask,
gcoBRUSH * Brush
)
{
gceSTATUS status;
gcmHEADER_ARG("Hal=0x%x OriginX=%d OriginY=%d ColorConvert=%d FgColor=%x BgColor=%x"
"Bits=%lld Mask=%llx Brush=0x%x",
Hal, OriginX, OriginY, ColorConvert, FgColor, BgColor,
Bits, Mask, Brush);
/* Verify the arguments. */
gcmVERIFY_OBJECT(Hal, gcvOBJ_HAL);
gcmVERIFY_ARGUMENT(OriginX < 8);
gcmVERIFY_ARGUMENT(OriginY < 8);
gcmVERIFY_ARGUMENT(ColorConvert <= 1);
gcmVERIFY_ARGUMENT(Brush != gcvNULL);
/* Create the brush. */
status = _Construct(Hal,
gcvSURF_A8R8G8B8,
OriginX,
OriginY,
ColorConvert,
FgColor,
BgColor,
Bits,
gcvNULL,
Mask,
Brush);
/* Return status. */
gcmFOOTER_ARG("*Brush=0x%x status=%d", *Brush, status);
return status;
}
/*******************************************************************************
**
** gcoBRUSH_ConstructColor
**
** Create a color gcoBRUSH object.
**
** INPUT:
**
** gcoHAL Hal
** Pointer to an gcoHAL object.
**
** gctUINT32 OriginX
** gctUINT32 OriginY
** Specifies the origin of the pattern in 0..7 range.
**
** gctPOINTER Address
** Location of the pattern bitmap in system memory.
**
** gceSURF_FORMAT Format
** Format of the source bitmap.
**
** gctUINT64 Mask
** 64 bits of mask, where each bit corresponds to one pixel of 8x8
** pattern. Each bit of the mask is used to determine transparency
** of the corresponding pixel, in other words, each mask bit is used
** to select between foreground or background ROPs. If the bit is 0,
** background ROP is used on the pixel; if 1, the foreground ROP
** is used. The mapping between Mask parameter bits and the actual
** pattern pixels is as follows:
**
** +----+----+----+----+----+----+----+----+
** | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
** +----+----+----+----+----+----+----+----+
** | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 |
** +----+----+----+----+----+----+----+----+
** | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 |
** +----+----+----+----+----+----+----+----+
** | 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 |
** +----+----+----+----+----+----+----+----+
** | 39 | 38 | 37 | 36 | 35 | 34 | 33 | 32 |
** +----+----+----+----+----+----+----+----+
** | 47 | 46 | 45 | 44 | 43 | 42 | 41 | 40 |
** +----+----+----+----+----+----+----+----+
** | 55 | 54 | 53 | 52 | 51 | 50 | 49 | 48 |
** +----+----+----+----+----+----+----+----+
** | 63 | 62 | 61 | 60 | 59 | 58 | 57 | 56 |
** +----+----+----+----+----+----+----+----+
**
** OUTPUT:
**
** gcoBRUSH * Brush
** Pointer to the variable that will hold the gcoBRUSH object pointer.
*/
gceSTATUS
gcoBRUSH_ConstructColor(
IN gcoHAL Hal,
IN gctUINT32 OriginX,
IN gctUINT32 OriginY,
IN gctPOINTER Address,
IN gceSURF_FORMAT Format,
IN gctUINT64 Mask,
gcoBRUSH * Brush
)
{
gceSTATUS status;
gcmHEADER_ARG("Hal=0x%x OriginX=%d OriginY=%d Address=0x%x Format=%d Mask=%llx Brush=0x%x",
Hal, OriginX, OriginY, Address, Format, Mask, Brush);
/* Verify the arguments. */
gcmVERIFY_OBJECT(Hal, gcvOBJ_HAL);
gcmVERIFY_ARGUMENT(OriginX < 8);
gcmVERIFY_ARGUMENT(OriginY < 8);
gcmVERIFY_ARGUMENT(Address != gcvNULL);
gcmVERIFY_ARGUMENT(Brush != gcvNULL);
/* Create the brush. */
status = _Construct(Hal,
Format,
OriginX,
OriginY,
0,
0,
0,
0,
Address,
Mask,
Brush);
/* Return status. */
gcmFOOTER_ARG("*Brush=0x%x status=%d", *Brush, status);
return status;
}
/*******************************************************************************
**
** gcoBRUSH_Destroy
**
** Destroy an gcoBRUSH object.
**
** INPUT:
**
** gcoBRUSH Brush
** Pointer to an gcoBRUSH object to be destroyed.
**
** OUTPUT:
**
** Nothing.
*/
gceSTATUS
gcoBRUSH_Destroy(
IN gcoBRUSH Brush
)
{
gceSTATUS status;
gcoBRUSH_CACHE brushCache;
gcmHEADER_ARG("Brush=0x%x", Brush);
/* Verify the arguments. */
gcmVERIFY_OBJECT(Brush, gcvOBJ_BRUSH);
/* Query the brush cache pointer. */
status = gco2D_GetBrushCache(Brush->engine, &brushCache);
if (status < 0)
{
/* Error. */
gcmFOOTER();
return status;
}
/* Call gcoBRUSH_CACHE object to complete the call. */
status = gcoBRUSH_CACHE_DeleteBrush(brushCache, Brush);
/* Return status. */
gcmFOOTER();
return status;
}
/*******************************************************************************
**
** gcoBRUSH_Delete
**
** Frees all resources held up the specified gcoBRUSH object.
**
** INPUT:
**
** gcoBRUSH Brush
** Pointer to an gcoBRUSH object to be deleted.
**
** OUTPUT:
**
** Nothing.
*/
gceSTATUS
gcoBRUSH_Delete(
IN gcoBRUSH Brush
)
{
gcmHEADER_ARG("Brush=0x%x", Brush);
/* Verify the arguments. */
gcmVERIFY_OBJECT(Brush, gcvOBJ_BRUSH);
/* Free the bitmap. */
if (Brush->colorBits != gcvNULL)
{
gcmVERIFY_OK(gcoOS_Free(Brush->hal->os, Brush->colorBits));
}
/* Mark gcoBRUSH object as unknown. */
Brush->object.type = gcvOBJ_UNKNOWN;
/* Free the gcoBRUSH object. */
gcmVERIFY_OK(gcoOS_Free(Brush->hal->os, Brush));
/* Success. */
gcmFOOTER_NO();
return gcvSTATUS_OK;
}
/*******************************************************************************
**
** gcoBRUSH_GetBrushData
**
** Return a buffer filled with complete set of brush data.
**
** INPUT:
**
** gcoBRUSH Brush
** Pointer to an gcoBRUSH object to be deleted.
**
** OUTPUT:
**
** gctPOINTER BrushData
** Brush data buffer.
**
** gctUINT32 * DataCount
** Number of bytes in the brush data array.
*/
gceSTATUS
gcoBRUSH_GetBrushData(
IN gcoBRUSH Brush,
IN OUT gctPOINTER BrushData,
IN OUT gctUINT32 * DataCount
)
{
gceSTATUS status;
gcmHEADER_ARG("Brush=0x%x BrushData=0x%x DataCount=0x%x", Brush, BrushData, DataCount);
/* Verify the arguments. */
gcmVERIFY_OBJECT(Brush, gcvOBJ_BRUSH);
/* Build the buffer from the new brush. */
status = _BuildBrushBuffer(Brush->hal->hardware,
Brush->format,
Brush->originX,
Brush->originY,
Brush->colorConvert,
Brush->fgColor,
Brush->bgColor,
Brush->monoBits,
Brush->colorBits,
Brush->mask,
(gctUINT8 *) BrushData,
DataCount);
/* Return status. */
gcmFOOTER_ARG("*DataCount=%d status=%d", *DataCount, status);
return status;
}
/*******************************************************************************
**
** gcoBRUSH_FlushBrush
**
** Flush the brush.
**
** INPUT:
**
** gcoBRUSH Brush
** Pointer to an gcoBRUSH object to be deleted.
**
* gctBOOL Upload
** If not zero, the flush function will upload the pattern data
** to the video memory block.
**
** gcuVIDMEM_NODE_PTR Node
** Pointer to video memory node object.
**
** OUTPUT:
**
** Nothing.
*/
gceSTATUS
gcoBRUSH_FlushBrush(
IN gcoBRUSH Brush,
IN gctBOOL Upload,
IN gcsSURF_NODE_PTR Node
)
{
gceSTATUS status;
gcoHARDWARE hardware;
gcmHEADER_ARG("Brush=0x%x Upload=%d Node=0x%x", Brush, Upload, Node);
/* Verify the arguments. */
gcmVERIFY_OBJECT(Brush, gcvOBJ_BRUSH);
/* Extract the gcoHARDWARE object pointer. */
hardware = Brush->hal->hardware;
gcmVERIFY_OBJECT(hardware, gcvOBJ_HARDWARE);
/* Program the brush. */
do
{
if (Brush->colorBits != gcvNULL)
{
/*
Color brush.
*/
/* Verify that the surface is locked. */
gcmVERIFY_NODE_LOCK(Node);
/* Copy the pattern to the video memory. */
if (Upload)
{
gcmVERIFY_OK(gcoOS_MemCopy(Node->logical,
Brush->colorBits,
Brush->colorSize));
gcmVERIFY_OK(gcoOS_CacheFlush(Brush->hal->os,
Node->logical,
Brush->colorSize));
}
/* Load the pattern. */
status = gcoHARDWARE_LoadColorPattern(hardware,
Brush->originX,
Brush->originY,
Node->physical,
Brush->format,
Brush->mask);
}
else if ((Brush->originX != ~0) && (Brush->originY != ~0))
{
/*
Monochrome brush.
*/
status = gcoHARDWARE_LoadMonochromePattern(hardware,
Brush->originX,
Brush->originY,
Brush->colorConvert,
Brush->fgColor,
Brush->bgColor,
Brush->monoBits,
Brush->mask);
}
else
{
/*
Solid color brush.
*/
status = gcoHARDWARE_LoadSolidColorPattern(hardware,
Brush->colorConvert,
Brush->fgColor,
Brush->mask);
}
}
while (gcvFALSE);
/* Return status. */
gcmFOOTER();
return status;
}

View File

@ -1,140 +0,0 @@
/****************************************************************************
*
* Copyright (c) 2005 - 2010 by Vivante Corp. All rights reserved.
*
* The material in this file is confidential and contains trade secrets
* of Vivante Corporation. This is proprietary information owned by
* Vivante Corporation. No part of this work may be disclosed,
* reproduced, copied, transmitted, or used in any way for any purpose,
* without the express written permission of Vivante Corporation.
*
*****************************************************************************
*
* Auto-generated file on 11/10/2010. Do not edit!!!
*
*****************************************************************************/
#ifndef __gc_hal_user_brush_h_
#define __gc_hal_user_brush_h_
#ifdef __cplusplus
extern "C" {
#endif
/******************************************************************************\
***************************** gcoBRUSH_CACHE Object *****************************
\******************************************************************************/
/* Create an gcoBRUSH_CACHE object. */
gceSTATUS
gcoBRUSH_CACHE_Construct(
IN gcoHAL Hal,
gcoBRUSH_CACHE * BrushCache
);
/* Destroy an gcoBRUSH_CACHE object. */
gceSTATUS
gcoBRUSH_CACHE_Destroy(
IN gcoBRUSH_CACHE BrushCache
);
/* Sets the maximum number of brushes in the cache. */
gceSTATUS
gcoBRUSH_CACHE_SetBrushLimit(
IN gcoBRUSH_CACHE BrushCache,
IN gctUINT MaxCount
);
/* Compute the brush ID based on the brush data. */
gceSTATUS
gcoBRUSH_CACHE_GetBrushID(
IN gcoBRUSH_CACHE BrushCache,
IN gctPOINTER BrushData,
IN gctUINT32 DataCount,
IN OUT gctUINT32 * BrushID
);
/* Find a matching brush by the passed brush data set and return a pointer
to the brush. If a matching brush was found, its usage counter is
automatically incremented. Call gcoBRUSH_CACHE_DeleteBrush
to release the brush. */
gceSTATUS
gcoBRUSH_CACHE_GetBrush(
IN gcoBRUSH_CACHE BrushCache,
IN gctUINT32 BrushID,
IN gctPOINTER BrushData,
IN gctUINT32 DataCount,
IN OUT gcoBRUSH * Brush
);
/* Add a brush to the brush cache. */
gceSTATUS
gcoBRUSH_CACHE_AddBrush(
IN gcoBRUSH_CACHE BrushCache,
IN gcoBRUSH Brush,
IN gctUINT32 BrushID,
IN gctBOOL NeedMemory
);
/* Remove a brush from the brush cache. */
gceSTATUS
gcoBRUSH_CACHE_DeleteBrush(
IN gcoBRUSH_CACHE BrushCache,
IN gcoBRUSH Brush
);
/* Flush the brush. */
gceSTATUS
gcoBRUSH_CACHE_FlushBrush(
IN gcoBRUSH_CACHE BrushCache,
IN gcoBRUSH Brush
);
/******************************************************************************\
******************************** gcoBRUSH Object *******************************
\******************************************************************************/
/* Frees all resources held up the specified gcoBRUSH object. */
gceSTATUS
gcoBRUSH_Delete(
IN gcoBRUSH Brush
);
/* Returns a buffer fileld with complete set of brush parameters. */
gceSTATUS
gcoBRUSH_GetBrushData(
IN gcoBRUSH Brush,
IN OUT gctPOINTER BrushData,
IN OUT gctUINT32 * DataCount
);
/* Flush the brush. */
gceSTATUS
gcoBRUSH_FlushBrush(
IN gcoBRUSH Brush,
IN gctBOOL Upload,
IN gcsSURF_NODE_PTR Node
);
/******************************************************************************\
********************************** gco2D Object *********************************
\******************************************************************************/
/* Return a pointer to the brush cache. */
gceSTATUS
gco2D_GetBrushCache(
IN gco2D Hardware,
IN OUT gcoBRUSH_CACHE * BrushCache
);
#ifdef __cplusplus
}
#endif
#endif /* __gc_hal_user_brush_h_ */

View File

@ -1,851 +0,0 @@
/****************************************************************************
*
* Copyright (c) 2005 - 2010 by Vivante Corp. All rights reserved.
*
* The material in this file is confidential and contains trade secrets
* of Vivante Corporation. This is proprietary information owned by
* Vivante Corporation. No part of this work may be disclosed,
* reproduced, copied, transmitted, or used in any way for any purpose,
* without the express written permission of Vivante Corporation.
*
*****************************************************************************
*
* Auto-generated file on 11/10/2010. Do not edit!!!
*
*****************************************************************************/
/**
** @file
** gcoBUFFER object for user HAL layers.
**
*/
#include "gc_hal_user_precomp.h"
#include "gc_hal_user_context.h"
#define _GC_OBJ_ZONE gcvZONE_BUFFER
/******************************************************************************\
********************************** Structures **********************************
\******************************************************************************/
struct _gcoBUFFER
{
/* Object. */
gcsOBJECT object;
/* Pointer to the required objects. */
gcoOS os;
gcoHAL hal;
gcoHARDWARE hardware;
/* Size of buffer. */
gctSIZE_T size;
gctSIZE_T maxSize;
/* Array of command buffers and their signals. */
gcoCMDBUF commandBuffers[gcdCMD_BUFFERS];
gctSIGNAL signal[gcdCMD_BUFFERS];
/* Current command buffer. */
gctUINT currentCommandBufferIndex;
gcoCMDBUF currentCommandBuffer;
/* Reserved bytes. */
struct _gcsCOMMAND_INFO
{
gctSIZE_T alignment;
gctSIZE_T reservedHead;
gctSIZE_T reservedTail;
} info;
gctSIZE_T totalReserved;
};
/******************************************************************************\
***************************** gcoCMDBUF Object Code *****************************
\******************************************************************************/
/*******************************************************************************
**
** gcoCMDBUF_Construct
**
** Construct a new gcoCMDBUF object.
**
** INPUT:
**
** gcoOS Os
** Pointer to a gcoOS object.
**
** gcoHARDWARE Hardware
** Pointer to a gcoHARDWARE object.
**
** gctSIZE_T Bytes
** Number of bytes for the buffer.
**
** gcsCOMMAND_BUFFER_PTR Info
** Alignment and head/tail information.
**
** OUTPUT:
**
** gcoCMDBUF * CommandBuffer
** Pointer to a variable that will hold the the gcoCMDBUF object
** pointer.
*/
gceSTATUS
gcoCMDBUF_Construct(
IN gcoOS Os,
IN gcoHARDWARE Hardware,
IN gctSIZE_T Bytes,
IN gcsCOMMAND_INFO_PTR Info,
OUT gcoCMDBUF * CommandBuffer
)
{
gceSTATUS status;
gcoCMDBUF commandBuffer = gcvNULL;
gcmHEADER_ARG("Os=0x%x Hardware=0x%x Bytes=%lu Info=0x%x",
Os, Hardware, Bytes, Info);
#ifdef __QNXNTO__
gctPHYS_ADDR physical;
gctSIZE_T bytes;
#endif
/* Verify the arguments. */
gcmVERIFY_OBJECT(Os, gcvOBJ_OS);
gcmVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE);
gcmVERIFY_ARGUMENT(Bytes > 0);
gcmVERIFY_ARGUMENT(CommandBuffer != gcvNULL);
/* Allocate the gcoCMDBUF object. */
#ifdef __QNXNTO__
bytes = gcmSIZEOF(struct _gcoCMDBUF);
gcmONERROR(
gcoOS_AllocateContiguous(Os,
gcvTRUE,
&bytes,
&physical,
(gctPOINTER *) &commandBuffer));
#else
gcmONERROR(
gcoOS_Allocate(Os,
gcmSIZEOF(struct _gcoCMDBUF),
(gctPOINTER *) &commandBuffer));
#endif
/* Initialize the gcoCMDBUF object. */
commandBuffer->object.type = gcvOBJ_COMMANDBUFFER;
commandBuffer->os = Os;
commandBuffer->hardware = Hardware;
commandBuffer->bytes = Bytes;
commandBuffer->logical = gcvNULL;
/* Allocate the physical buffer for the command. */
gcmONERROR(
gcoOS_AllocateContiguous(Os,
gcvTRUE,
&commandBuffer->bytes,
&commandBuffer->physical,
&commandBuffer->logical));
/* Initialize command buffer. */
commandBuffer->offset = 0;
commandBuffer->free = commandBuffer->bytes;
#if gcdSECURE_USER
/* Allocate memory for the map table. */
gcmONERROR(
gcoOS_Allocate(Os, Bytes, (gctPOINTER *) &commandBuffer->hintTable));
#endif
/* Return pointer to the gcoCMDBUF object. */
*CommandBuffer = commandBuffer;
/* Success. */
gcmFOOTER_ARG("*CommandBuffer=0x%x", *CommandBuffer);
return gcvSTATUS_OK;
OnError:
if (commandBuffer != gcvNULL)
{
if (commandBuffer->logical != gcvNULL)
{
/* Roll back the contiguous memory allocation. */
gcmVERIFY_OK(
gcoOS_FreeContiguous(Os,
commandBuffer->physical,
commandBuffer->logical,
commandBuffer->bytes));
#ifdef __QNXNTO__
/* Roll back the command buffer allocation. */
gcmVERIFY_OK(
gcoOS_FreeContiguous(Os,
gcvNULL,
commandBuffer,
gcmSIZEOF(struct _gcoCMDBUF)));
#endif
}
/* Roll back. */
gcmVERIFY_OK(gcoOS_Free(Os, commandBuffer));
}
/* Return the status. */
gcmFOOTER();
return status;
}
/*******************************************************************************
**
** gcoCMDBUF_Destroy
**
** Destroy a gcoCMDBUF object.
**
** INPUT:
**
** gcoCMDBUF CommandBuffer
** Pointer to an gcoCMDBUF object.
**
** OUTPUT:
**
** None.
*/
gceSTATUS
gcoCMDBUF_Destroy(
IN gcoCMDBUF CommandBuffer
)
{
gceSTATUS status;
gcsHAL_INTERFACE iface;
gcmHEADER_ARG("CommandBuffer=0x%x", CommandBuffer);
/* Verify the object. */
gcmVERIFY_OBJECT(CommandBuffer, gcvOBJ_COMMANDBUFFER);
/* Use events to free the buffer. */
iface.command = gcvHAL_FREE_CONTIGUOUS_MEMORY;
iface.u.FreeContiguousMemory.bytes = CommandBuffer->bytes;
iface.u.FreeContiguousMemory.physical = CommandBuffer->physical;
iface.u.FreeContiguousMemory.logical = CommandBuffer->logical;
/* Send event. */
gcmONERROR(
gcoHARDWARE_CallEvent(CommandBuffer->hardware, &iface));
#if gcdSECURE_USER
/* Free the map table. */
gcmVERIFY_OK(gcoOS_Free(CommandBuffer->os, CommandBuffer->hintTable));
#endif
/* Free the gcoCMDBUF object. */
#ifdef __QNXNTO__
gcmVERIFY_OK(gcoOS_FreeContiguous(CommandBuffer->os,
gcvNULL,
CommandBuffer,
gcmSIZEOF(struct _gcoCMDBUF)));
#else
gcmVERIFY_OK(gcoOS_Free(CommandBuffer->os, CommandBuffer));
#endif
/* Success. */
gcmFOOTER_NO();
return gcvSTATUS_OK;
OnError:
/* Return the status. */
gcmFOOTER();
return status;
}
/******************************************************************************\
******************************* gcoBUFFER API Code ******************************
\******************************************************************************/
gceSTATUS
_GetCMDBUF(
IN gcoBUFFER Buffer
)
{
gcoCMDBUF command;
gceSTATUS status;
gcmHEADER_ARG("Buffer=0x%x", Buffer);
/* Increment current command buffer index. */
Buffer->currentCommandBufferIndex =
(Buffer->currentCommandBuffer == gcvNULL)
? 0
: ((Buffer->currentCommandBufferIndex + 1) % gcdCMD_BUFFERS);
Buffer->currentCommandBuffer =
Buffer->commandBuffers[Buffer->currentCommandBufferIndex];
/* Wait for buffer to become available. */
gcmONERROR(
gcoOS_WaitSignal(Buffer->os,
Buffer->signal[Buffer->currentCommandBufferIndex],
gcvINFINITE));
/* Grab pointer to current command buffer. */
command = Buffer->currentCommandBuffer;
/* Reset command buffer. */
command->startOffset = 0;
command->offset = Buffer->info.reservedHead;
command->free = command->bytes - Buffer->totalReserved;
#if gcdSECURE_USER
/* Reset mapping table. */
command->hintIndex = command->hintTable;
command->hintCommit = command->hintTable;
#endif
/* Succees. */
gcmFOOTER_ARG("currentCommandBufferIndex=%d",
Buffer->currentCommandBufferIndex);
return gcvSTATUS_OK;
OnError:
/* Return the status. */
gcmFOOTER();
return status;
}
/*******************************************************************************
**
** gcoBUFFER_Construct
**
** Construct a new gcoBUFFER object.
**
** INPUT:
**
** gcoHAL Hal
** Pointer to an gcoHAL object.
**
** gcoHARDWARE Hardware
** Pointer to an gcoHARDWARE object.
**
** gctSIZE_T MaxSize
** Maximum size of buffer.
**
** OUTPUT:
**
** gcoBUFFER * Buffer
** Pointer to a variable that will hold the the gcoBUFFER object
** pointer.
*/
gceSTATUS
gcoBUFFER_Construct(
IN gcoHAL Hal,
IN gcoHARDWARE Hardware,
IN gctSIZE_T MaxSize,
OUT gcoBUFFER * Buffer
)
{
gcoBUFFER buffer = gcvNULL;
gceSTATUS status;
gctUINT i = 0;
gcmHEADER_ARG("Hal=0x%x Hardware=0x%x MaxSize=%lu", Hal, Hardware, MaxSize);
/* Verify the arguments. */
gcmVERIFY_OBJECT(Hal, gcvOBJ_HAL);
gcmVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE);
gcmVERIFY_ARGUMENT(Buffer != gcvNULL);
/* Allocate the gcoBUFFER object. */
gcmONERROR(
gcoOS_Allocate(Hal->os,
gcmSIZEOF(struct _gcoBUFFER),
(gctPOINTER *) &buffer));
/* Initialize the gcoBUFFER object. */
buffer->object.type = gcvOBJ_BUFFER;
buffer->hal = Hal;
buffer->os = Hal->os;
buffer->hardware = Hardware;
/* Maximum size of buffer. */
buffer->size = 0;
buffer->maxSize = MaxSize;
/* Query alignment. */
gcmONERROR(
gcoHARDWARE_QueryCommandBuffer(Hardware,
&buffer->info.alignment,
&buffer->info.reservedHead,
&buffer->info.reservedTail));
buffer->totalReserved = buffer->info.reservedHead
+ buffer->info.reservedTail
+ buffer->info.alignment;
/* Zero the command buffers. */
for (i = 0; i < gcmCOUNTOF(buffer->commandBuffers); ++i)
{
buffer->commandBuffers[i] = gcvNULL;
buffer->signal[i] = gcvNULL;
}
/* Initialize the command buffers. */
for (i = 0; i < gcmCOUNTOF(buffer->commandBuffers); ++i)
{
/* Construct a command buffer. */
gcmONERROR(
gcoCMDBUF_Construct(buffer->os,
buffer->hardware,
buffer->maxSize,
&buffer->info,
&buffer->commandBuffers[i]));
/* Create the signal. */
gcmONERROR(
gcoOS_CreateSignal(buffer->os,
gcvFALSE,
&buffer->signal[i]));
/* Mark the buffer as available. */
gcmONERROR(
gcoOS_Signal(buffer->os,
buffer->signal[i],
gcvTRUE));
}
/* Grab the first command buffer. */
buffer->currentCommandBuffer = gcvNULL;
gcmONERROR(_GetCMDBUF(buffer));
/* Return pointer to the gcoBUFFER object. */
*Buffer = buffer;
/* Success. */
gcmFOOTER_ARG("*Buffer=0x%x", *Buffer);
return gcvSTATUS_OK;
OnError:
if (buffer != gcvNULL)
{
/* Roll back all command buffers. */
for (i = 0; i < gcmCOUNTOF(buffer->commandBuffers); ++i)
{
if (buffer->commandBuffers[i] != gcvNULL)
{
/* Destroy command buffer. */
gcmVERIFY_OK(
gcoCMDBUF_Destroy(buffer->commandBuffers[i]));
}
if (buffer->signal[i] != gcvNULL)
{
/* Destroy signal. */
gcmVERIFY_OK(
gcoOS_DestroySignal(Hal->os,
buffer->signal[i]));
}
}
/* Free the object memory. */
gcmVERIFY_OK(gcoOS_Free(Hal->os, buffer));
}
/* Return the status. */
gcmFOOTER();
return status;
}
/*******************************************************************************
**
** gcoBUFFER_Destroy
**
** Destroy an gcoBUFFER object.
**
** INPUT:
**
** gcoBUFFER Buffer
** Pointer to an gcoBUFFER object to delete.
**
** OUTPUT:
**
** Nothing.
*/
gceSTATUS
gcoBUFFER_Destroy(
IN gcoBUFFER Buffer
)
{
gctUINT i = 0;
gcmHEADER_ARG("Buffer=0x%x", Buffer);
/* Verify the arguments. */
gcmVERIFY_OBJECT(Buffer, gcvOBJ_BUFFER);
/* Commit buffer before destroying it. */
if (Buffer->size != 0)
{
/* Commit the command buffers. */
gcmVERIFY_OK(gcoHARDWARE_Commit(Buffer->hardware));
/* Stall the hardware. */
gcmVERIFY_OK(gcoHARDWARE_Stall(Buffer->hardware));
}
/* Delete all allocated buffers. */
for (i = 0; i < gcmCOUNTOF(Buffer->commandBuffers); ++i)
{
/* Destroy the command buffer. */
gcmVERIFY_OK(
gcoCMDBUF_Destroy(Buffer->commandBuffers[i]));
/* Destroy the signal. */
gcmVERIFY_OK(
gcoOS_DestroySignal(Buffer->os, Buffer->signal[i]));
}
/* Free the gcoBUFFER object. */
gcmVERIFY_OK(gcoOS_Free(Buffer->os, Buffer));
/* Success. */
gcmFOOTER_NO();
return gcvSTATUS_OK;
}
/*******************************************************************************
**
** gcoBUFFER_Write
**
** Copy a number of bytes into the buffer.
**
** INPUT:
**
** gcoBUFFER Buffer
** Pointer to an gcoBUFFER object.
**
** gctCONST_POINTER Data
** Pointer to a buffer that contains the data to be copied.
**
** IN gctSIZE_T Bytes
** Number of bytes to copy.
**
** IN gctBOOL Aligned
** gcvTRUE if the data needs to be aligned to 64-bit.
**
** OUTPUT:
**
** Nothing.
*/
gceSTATUS
gcoBUFFER_Write(
IN gcoBUFFER Buffer,
IN gctCONST_POINTER Data,
IN gctSIZE_T Bytes,
IN gctBOOL Aligned
)
{
gceSTATUS status;
gctPOINTER memory;
gcmHEADER_ARG("Buffer=0x%x Data=0x%x Bytes=%lu Aligned=%d",
Buffer, Data, Bytes, Aligned);
/* Verify the arguments. */
gcmVERIFY_OBJECT(Buffer, gcvOBJ_BUFFER);
gcmVERIFY_ARGUMENT(Data != gcvNULL);
gcmVERIFY_ARGUMENT(Bytes > 0);
/* Reserve data in the buffer. */
gcmONERROR(
gcoBUFFER_Reserve(Buffer, Bytes, Aligned, gcvNULL, &memory));
/* Write data into the buffer. */
gcmONERROR(
gcoOS_MemCopy(memory, Data, Bytes));
/* Success. */
gcmFOOTER_NO();
return gcvSTATUS_OK;
OnError:
/* Return status. */
gcmFOOTER();
return status;
}
/*******************************************************************************
**
** gcoBUFFER_Reserve
**
** Reserve a number of bytes in the buffer.
**
** INPUT:
**
** gcoBUFFER Buffer
** Pointer to an gcoBUFFER object.
**
** gctSIZE_T Bytes
** Number of bytes to reserve.
**
** gctBOOL Aligned
** gcvTRUE if the data needs to be aligned to 64-bit.
**
** gctBOOL_PTR AddressHints
** Optional pointer that points to an array of boolean values that
** define whether the state of the specified 32-bit valueis a physical
** address or not.
**
** OUTPUT:
**
** gctPOINTER * Memory
** Pointer to a variable that will hold the address of location in the
** buffer that has been reserved.
*/
gceSTATUS
gcoBUFFER_Reserve(
IN gcoBUFFER Buffer,
IN gctSIZE_T Bytes,
IN gctBOOL Aligned,
IN gctBOOL_PTR AddressHints,
OUT gctPOINTER * Memory
)
{
gceSTATUS status;
gcoCMDBUF current;
gctSIZE_T alignBytes, bytes;
gcmHEADER_ARG("Buffer=0x%x Bytes=%lu Aligned=%d AddressHints=0x%x",
Buffer, Bytes, Aligned, AddressHints);
/* Verify the arguments. */
gcmVERIFY_OBJECT(Buffer, gcvOBJ_BUFFER);
gcmVERIFY_ARGUMENT(Memory != gcvNULL);
/* Get the current command buffer. */
current = Buffer->currentCommandBuffer;
/* Compute the number of aligned bytes. */
alignBytes = Aligned
? ( gcmALIGN(current->offset, Buffer->info.alignment)
- current->offset
)
: 0;
/* Compute the number of required bytes. */
bytes = Bytes + alignBytes;
if (bytes > Buffer->maxSize - Buffer->totalReserved)
{
/* This just won't fit! */
gcmFATAL("FATAL: Command of %lu bytes is too big!", Bytes);
gcmONERROR(gcvSTATUS_OUT_OF_MEMORY);
}
if (bytes > current->free)
{
gcsHAL_INTERFACE iface;
/* Sent event to signal when command buffer completes. */
iface.command = gcvHAL_SIGNAL;
iface.u.Signal.signal = Buffer->signal
[Buffer->currentCommandBufferIndex];
iface.u.Signal.auxSignal = gcvNULL;
iface.u.Signal.process = Buffer->hal->process;
iface.u.Signal.fromWhere = gcvKERNEL_COMMAND;
/* Send event. */
gcmONERROR(
gcoHARDWARE_CallEvent(Buffer->hardware, &iface));
/* Commit current command buffer. */
gcmONERROR(
gcoHARDWARE_Commit(Buffer->hardware));
/* Grab a new command buffer. */
gcmONERROR(
_GetCMDBUF(Buffer));
/* Get the pointer. */
current = Buffer->currentCommandBuffer;
/* Calculate total bytes again. */
alignBytes = 0;
bytes = Bytes;
}
gcmASSERT(current != gcvNULL);
gcmASSERT(bytes <= current->free);
/* Allocate space in current command buffer. */
*Memory = (gctUINT8_PTR) current->logical + current->offset + alignBytes;
#if gcdSECURE_USER
/* See if there is an address hint. */
if (AddressHints != gcvNULL)
{
gctSIZE_T i;
gctUINT32 offset = current->offset + alignBytes;
/* Walk the address hint array. */
for (i = 0;
i < Bytes / gcmSIZEOF(gctBOOL);
++i, offset += gcmSIZEOF(gctUINT32)
)
{
/* Check for a hinted address at the specified location. */
if (AddressHints[i])
{
*current->hintIndex++ = offset;
}
}
}
#endif
/* Adjust command buffer size. */
current->offset += bytes;
current->free -= bytes;
/* Success. */
gcmFOOTER_ARG("*Memory=0x%x", *Memory);
return gcvSTATUS_OK;
OnError:
/* Return the status. */
gcmFOOTER();
return status;
}
/*******************************************************************************
**
** gcoBUFFER_Commit
**
** Commit the command buffer to the hardware.
**
** INPUT:
**
** gcoBUFFER Buffer
** Pointer to a gcoBUFFER object.
**
** gcoCONTEXT Context
** Pointer to a gcoCONTEXT object.
**
** gcoQUEUE Queue
** Pointer to a gcoQUEUE object.
**
** OUTPUT:
**
** Nothing.
*/
gceSTATUS
gcoBUFFER_Commit(
IN gcoBUFFER Buffer,
IN gcoCONTEXT Context,
IN gcoQUEUE Queue
)
{
gcsHAL_INTERFACE iface;
gceSTATUS status;
gcoCMDBUF current;
gcmHEADER_ARG("Buffer=0x%x Context=0x%x Queue=0x%x", Buffer, Context, Queue);
/* Verify the arguments. */
gcmVERIFY_OBJECT(Buffer, gcvOBJ_BUFFER);
gcmVERIFY_OBJECT(Context, gcvOBJ_CONTEXT);
gcmVERIFY_OBJECT(Queue, gcvOBJ_QUEUE);
/* Grab current command buffer. */
current = Buffer->currentCommandBuffer;
if (current == gcvNULL)
{
/* No command buffer, done. */
gcmFOOTER_NO();
return gcvSTATUS_OK;
}
if (current->offset - current->startOffset <= Buffer->info.reservedHead)
{
/* Commit the event queue. */
status = gcoQUEUE_Commit(Queue);
gcmFOOTER();
return status;
}
/* Make sure the tail got aligned properly. */
current->offset = gcmALIGN(current->offset, Buffer->info.alignment);
if (Buffer->hal->dump != gcvNULL)
{
/* Dump the command buffer. */
gcmVERIFY_OK(
gcoDUMP_DumpData(Buffer->hal->dump,
gcvTAG_COMMAND,
0,
current->offset
- current->startOffset
- Buffer->info.reservedHead,
(gctUINT8_PTR) current->logical
+ current->startOffset
+ Buffer->info.reservedHead));
}
#if gcdSECURE_USER
/* Mark the end of the map table. */
*current->hintIndex++ = 0;
#endif
/* Send command and context buffer to hardware. */
iface.command = gcvHAL_COMMIT;
iface.u.Commit.commandBuffer = current;
iface.u.Commit.contextBuffer = Context;
iface.u.Commit.process = gcoOS_GetCurrentProcessID();
/* Call kernel service. */
gcmONERROR(
gcoOS_DeviceControl(Buffer->os,
IOCTL_GCHAL_INTERFACE,
&iface, gcmSIZEOF(iface),
&iface, gcmSIZEOF(iface)));
gcmONERROR(iface.status);
/* Advance the offset for next commit. */
current->startOffset = current->offset + Buffer->info.reservedTail;
if (current->bytes - current->startOffset > Buffer->totalReserved)
{
/* Adjust buffer offset and size. */
current->offset = current->startOffset + Buffer->info.reservedHead;
current->free = current->bytes - current->offset
- Buffer->info.alignment
- Buffer->info.reservedTail;
}
else
{
/* Buffer is full. */
current->startOffset = current->bytes;
current->offset = current->bytes;
current->free = 0;
}
#if gcdSECURE_USER
current->hintCommit = current->hintIndex;
#endif
/* Commit the event queue. */
gcmONERROR(gcoQUEUE_Commit(Queue));
/* Success. */
gcmFOOTER_NO();
return gcvSTATUS_OK;
OnError:
/* Return the status. */
gcmFOOTER();
return status;
}

View File

@ -1,170 +0,0 @@
/****************************************************************************
*
* Copyright (C) 2005 - 2010 by Vivante Corp.
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*****************************************************************************/
#ifndef __gc_hal_user_context_h_
#define __gc_hal_user_context_h_
#ifdef __cplusplus
extern "C" {
#endif
/* gcoCONTEXT structure that hold the current context. */
struct _gcoCONTEXT
{
/* Object. */
gcsOBJECT object;
/* Pointer to gcoOS object. */
gcoOS os;
/* Pointer to gcoHARDWARE object. */
gcoHARDWARE hardware;
/* Context ID. */
gctUINT64 id;
/* State mapping. */
gctUINT32_PTR map;
gctSIZE_T stateCount;
/* State hinting. */
gctUINT8_PTR hint;
gctUINT8 hintValue;
gctSIZE_T hintCount;
/* Context buffer. */
gctUINT32_PTR buffer;
gctUINT32 pipe3DIndex;
gctUINT32 pipe2DIndex;
gctUINT32 linkIndex;
gctUINT32 inUseIndex;
gctSIZE_T bufferSize;
/* Context buffer used for commitment. */
gctSIZE_T bytes;
gctPHYS_ADDR physical;
gctPOINTER logical;
/* Pointer to final LINK command. */
gctPOINTER link;
/* Requested pipe select for context. */
gctUINT32 initialPipe;
gctUINT32 entryPipe;
gctUINT32 currentPipe;
/* Flag to specify whether PostCommit needs to be called. */
gctBOOL postCommit;
/* Busy flag. */
volatile gctBOOL * inUse;
/* Variables used for building state buffer. */
gctUINT32 lastAddress;
gctSIZE_T lastSize;
gctUINT32 lastIndex;
gctBOOL lastFixed;
/* Hint array. */
gctUINT32_PTR hintArray;
gctUINT32_PTR hintIndex;
};
struct _gcoCMDBUF
{
/* The object. */
gcsOBJECT object;
/* Pointer to gcoOS object. */
gcoOS os;
/* Pointer to gcoHARDWARE object. */
gcoHARDWARE hardware;
/* Physical address of command buffer. */
gctPHYS_ADDR physical;
/* Logical address of command buffer. */
gctPOINTER logical;
/* Number of bytes in command buffer. */
gctSIZE_T bytes;
/* Start offset into the command buffer. */
gctUINT32 startOffset;
/* Current offset into the command buffer. */
gctUINT32 offset;
/* Number of free bytes in command buffer. */
gctSIZE_T free;
#if gcdSECURE_USER
/* Table of offsets that define the physical addresses to be mapped. */
gctUINT32_PTR hintTable;
/* Current index into map table. */
gctUINT32_PTR hintIndex;
/* Commit index for map table. */
gctUINT32_PTR hintCommit;
#endif
};
typedef struct _gcsQUEUE * gcsQUEUE_PTR;
typedef struct _gcsQUEUE
{
/* Pointer to next gcsQUEUE structure. */
gcsQUEUE_PTR next;
#ifdef __QNXNTO__
/* Size of this object. */
gctSIZE_T bytes;
#endif
/* Event information. */
gcsHAL_INTERFACE iface;
}
gcsQUEUE;
/* Event queue. */
struct _gcoQUEUE
{
/* The object. */
gcsOBJECT object;
/* Pointer to gcoOS object. */
gcoOS os;
/* Pointer to current event queue. */
gcsQUEUE_PTR head;
gcsQUEUE_PTR tail;
};
#ifdef __cplusplus
}
#endif
#endif /* __gc_hal_user_context_h_ */

View File

@ -1,884 +0,0 @@
/****************************************************************************
*
* Copyright (c) 2005 - 2010 by Vivante Corp. All rights reserved.
*
* The material in this file is confidential and contains trade secrets
* of Vivante Corporation. This is proprietary information owned by
* Vivante Corporation. No part of this work may be disclosed,
* reproduced, copied, transmitted, or used in any way for any purpose,
* without the express written permission of Vivante Corporation.
*
*****************************************************************************
*
* Auto-generated file on 11/10/2010. Do not edit!!!
*
*****************************************************************************/
#include "gc_hal_user_precomp.h"
/* Zone used for header/footer. */
#define _GC_OBJ_ZONE gcvZONE_HAL
/* gcoDUMP object structure. */
struct _gcoDUMP
{
/* The object. */
gcsOBJECT object;
/* Pointer to gcoOS and gcoHAL objects. */
gcoOS os;
gcoHAL hal;
/* Pointer to open file and accumulated length. */
gctFILE file;
gctSIZE_T length;
/* Frame information. */
gctINT32 frameCount;
gctUINT32 frameStart;
gctUINT32 frameLength;
};
/*******************************************************************************
**
** gcoDUMP_Construct
**
** Construct a new gcoDUMP object.
**
** INPUT:
**
** gcoOS Os
** Pointer to an gcoOS object.
**
** gcoOS Hal
** Pointer to an gcoHAL object.
**
** OUTPUT:
**
** gcoDUMP * Dump
** Pointer to a variable receiving the gcoDUMP object pointer.
*/
gceSTATUS
gcoDUMP_Construct(
IN gcoOS Os,
IN gcoHAL Hal,
OUT gcoDUMP * Dump
)
{
gceSTATUS status;
gcoDUMP dump;
gcmHEADER_ARG("Os=0x%x Hal=0x%x Dump=0x%x", Os, Hal, Dump);
/* Verify the arguments. */
gcmVERIFY_OBJECT(Os, gcvOBJ_OS);
gcmVERIFY_OBJECT(Hal, gcvOBJ_HAL);
gcmVERIFY_ARGUMENT(Dump != gcvNULL);
do
{
/* Allocate the gcoDUMP structure. */
gcmERR_BREAK(gcoOS_Allocate(Os, sizeof(struct _gcoDUMP), (gctPOINTER *) &dump));
/* Initialize the gcoDUMP object. */
dump->object.type = gcvOBJ_DUMP;
dump->os = Os;
dump->hal = Hal;
dump->file = gcvNULL;
/* Return pointer to the object. */
*Dump = dump;
}
while (gcvFALSE);
/* Return the status. */
gcmFOOTER_ARG("*Dump=0x%x", *Dump);
return status;
}
/*******************************************************************************
**
** gcoDUMP_Destroy
**
** Destroy a gcoDUMP object created by gcDUMP_COnstruct.
**
** INPUT:
**
** gcoDUMP Dump
** Pointer to a gcoDUMP object.
**
** OUTPUT:
**
** Nothing.
*/
gceSTATUS
gcoDUMP_Destroy(
IN gcoDUMP Dump
)
{
gcmHEADER_ARG("Dump=0x%x", Dump);
/* Verify the arguments. */
gcmVERIFY_OBJECT(Dump, gcvOBJ_DUMP);
if (Dump->file != gcvNULL)
{
if (Dump->frameStart != 0)
{
gcoDUMP_FrameEnd(Dump);
}
/* Close any open file. */
gcmVERIFY_OK(gcoDUMP_Control(Dump, gcvNULL));
}
if (Dump->hal->dump == Dump)
{
/* Remove current gcoDUMP object. */
Dump->hal->dump = gcvNULL;
}
/* Free the gcoDUMP structure. */
gcmVERIFY_OK(gcoOS_Free(Dump->os, Dump));
/* Success. */
gcmFOOTER_NO();
return gcvSTATUS_OK;
}
/*******************************************************************************
**
** gcoDUMP_Control
**
** Control dumping.
**
** INPUT:
**
** gcoDUMP Dump
** Pointer to a gcoDUMP object.
**
** gctSTRING FileName
** If 'FileName' is not gcvNULL, it points to the filename to be used for
** capturing all data. If 'FileName' is gcvNULL, turn off any current
** capturing.
**
** OUTPUT:
**
** Nothing.
*/
gceSTATUS
gcoDUMP_Control(
IN gcoDUMP Dump,
IN gctSTRING FileName
)
{
gceSTATUS status = gcvSTATUS_OK;
gcsDUMP_FILE header;
gctUINT32 pos;
gcmHEADER_ARG("Dump=0x%x FileName=0x%x", Dump, FileName);
/* Verify the arguments. */
gcmVERIFY_OBJECT(Dump, gcvOBJ_DUMP);
do
{
if (FileName != gcvNULL)
{
/* Need to create a new dump file. */
if (Dump->file == gcvNULL)
{
/* Create the dump file. */
gcmERR_BREAK(gcoOS_Open(Dump->os,
FileName,
gcvFILE_CREATE,
&Dump->file));
/* Write the file header. */
header.signature = gcvDUMP_FILE_SIGNATURE;
header.length = Dump->length = 0;
header.frames = Dump->frameCount = 0;
gcmERR_BREAK(gcoOS_Write(Dump->os,
Dump->file,
sizeof(header),
&header));
/* Frame is not yet started. */
Dump->frameStart = 0;
}
}
else
{
/* Need to close any current dump file. */
if (Dump->file != gcvNULL)
{
/* Close any open frame. */
if (Dump->frameStart != 0)
{
gcoDUMP_FrameEnd(Dump);
gcoDUMP_FrameBegin(Dump);
}
/* Get the current position. */
gcmERR_BREAK(gcoOS_GetPos(Dump->os, Dump->file, &pos));
/* Seek to the beginnnig of the file. */
gcmERR_BREAK(gcoOS_SetPos(Dump->os, Dump->file, 0));
/* Make sure we have the correct size. */
gcmASSERT(pos == Dump->length + sizeof(header));
/* Update the file header. */
header.signature = gcvDUMP_FILE_SIGNATURE;
header.length = Dump->length;
header.frames = Dump->frameCount;
gcmERR_BREAK(gcoOS_Write(Dump->os,
Dump->file,
sizeof(header),
&header));
/* Seek to the end of the file. */
gcmERR_BREAK(gcoOS_SetPos(Dump->os, Dump->file, pos));
/* Close the file. */
gcmERR_BREAK(gcoOS_Close(Dump->os, Dump->file));
/* Mark the file as closed. */
Dump->file = gcvNULL;
}
}
}
while (gcvFALSE);
/* Return the status. */
gcmFOOTER();
return status;
}
/*******************************************************************************
**
** gcoDUMP_IsEnabled
**
** Test whether dumping is enabeld or not.
**
** INPUT:
**
** gcoDUMP Dump
** Pointer to a gcoDUMP object.
**
** OUTPUT:
**
** gctBOOL * Enabled
** Pointer to a variable receiving the dump status.
*/
gceSTATUS
gcoDUMP_IsEnabled(
IN gcoDUMP Dump,
OUT gctBOOL * Enabled
)
{
gcmHEADER_ARG("Dump=0x%x Enabled=0x%x", Dump, Enabled);
/* Verify the arguments. */
gcmVERIFY_OBJECT(Dump, gcvOBJ_DUMP);
gcmVERIFY_ARGUMENT(Enabled != gcvNULL);
/* Return dump status. */
*Enabled = (Dump->file != gcvNULL);
/* Success. */
gcmFOOTER_ARG("*Enabled=%d", *Enabled);
return gcvSTATUS_OK;
}
/*******************************************************************************
**
** gcoDUMP_FrameBegin
**
** Mark the beginning of a frame.
**
** INPUT:
**
** gcoDUMP Dump
** Pointer to a gcoDUMP object.
**
** OUTPUT:
**
** Nothing.
*/
gceSTATUS
gcoDUMP_FrameBegin(
IN gcoDUMP Dump
)
{
gceSTATUS status;
gcsDUMP_DATA header;
gcmHEADER_ARG("Dump=0x%x", Dump);
/* Verify the arguments. */
gcmVERIFY_OBJECT(Dump, gcvOBJ_DUMP);
if ( (Dump->file == gcvNULL) || (Dump->frameStart != 0) )
{
/* There is no open dump file. */
return gcvSTATUS_OK;
}
do
{
/* Get the current position. */
gcmERR_BREAK(gcoOS_GetPos(Dump->os, Dump->file, &Dump->frameStart));
/* Write the frame header. */
header.type = gcvTAG_FRAME;
header.length = Dump->frameLength = 0;
header.address = 0;
gcmERR_BREAK(gcoOS_Write(Dump->os, Dump->file, sizeof(header), &header));
/* Update the file length. */
Dump->length += sizeof(header);
}
while (gcvFALSE);
/* Return the status. */
gcmFOOTER();
return status;
}
/*******************************************************************************
**
** gcoDUMP_FrameEnd
**
** Mark the end of a frame.
**
** INPUT:
**
** gcoDUMP Dump
** Pointer to a gcoDUMP object.
**
** OUTPUT:
**
** Nothing.
*/
gceSTATUS
gcoDUMP_FrameEnd(
IN gcoDUMP Dump
)
{
gceSTATUS status;
gcsDUMP_DATA header;
gctUINT32 pos;
gcmHEADER_ARG("Dump=0x%x", Dump);
/* Verify the arguments. */
gcmVERIFY_OBJECT(Dump, gcvOBJ_DUMP);
if (Dump->file == gcvNULL)
{
/* There is no open dump file. */
gcmFOOTER_NO();
return gcvSTATUS_OK;
}
do
{
/* Get the current position. */
gcmERR_BREAK(gcoOS_GetPos(Dump->os, Dump->file, &pos));
/* Seek to the beginning of the frame. */
gcmERR_BREAK(gcoOS_SetPos(Dump->os, Dump->file, Dump->frameStart));
/* Make sure we got the right byte count. */
gcmASSERT(pos - Dump->frameStart == Dump->frameLength + sizeof(header));
/* Update the frame header. */
header.type = gcvTAG_FRAME;
header.length = Dump->frameLength;
header.address = ++ Dump->frameCount;
gcmERR_BREAK(gcoOS_Write(Dump->os, Dump->file, sizeof(header), &header));
/* Seek to the end of the file. */
gcmERR_BREAK(gcoOS_SetPos(Dump->os, Dump->file, pos));
/* Mark the frame as ended. */
Dump->frameStart = 0;
}
while (gcvFALSE);
/* Return the status. */
gcmFOOTER();
return status;
}
/*******************************************************************************
**
** gcoDUMP_DumpData
**
** Dump data the file.
**
** INPUT:
**
** gcoDUMP Dump
** Pointer to a gcoDUMP object.
**
** gceDUMP_TAG Type
** Type of data.
**
** gctUINT32 Address
** Physical address to be used as a handle for the data.
**
** gctSIZE_T ByteCount
** Number of bytes to write.
**
** gctCONST_POINTER Data
** Pointer to the data to write.
**
** OUTPUT:
**
** Nothing.
*/
gceSTATUS
gcoDUMP_DumpData(
IN gcoDUMP Dump,
IN gceDUMP_TAG Type,
IN gctUINT32 Address,
IN gctSIZE_T ByteCount,
IN gctCONST_POINTER Data
)
{
gceSTATUS status;
gcsDUMP_DATA header;
gcmHEADER_ARG("Dump=0x%x Type=%d Address=%x ByteCount=%d Data=0x%x",
Dump, Type, Address, ByteCount, Data);
/* Verify the arguments. */
gcmVERIFY_OBJECT(Dump, gcvOBJ_DUMP);
gcmVERIFY_ARGUMENT(ByteCount > 0);
gcmVERIFY_ARGUMENT(Data != gcvNULL);
if (Dump->file == gcvNULL)
{
/* There is no open dump file. */
gcmFOOTER_NO();
return gcvSTATUS_OK;
}
do
{
/* Write the data record. */
header.type = Type;
header.length = ByteCount;
header.address = Address;
gcmERR_BREAK(
gcoOS_Write(Dump->os, Dump->file, sizeof(header), &header));
/* Write the data. */
gcmERR_BREAK(gcoOS_Write(Dump->os, Dump->file, ByteCount, Data));
/* Update the frame length. */
Dump->frameLength += sizeof(header) + ByteCount;
/* Update the file length. */
Dump->length += sizeof(header) + ByteCount;
}
while (gcvFALSE);
/* Return the status. */
gcmFOOTER();
return status;
}
/*******************************************************************************
**
** gcoDUMP_AddSurface
**
** Allocate a surface.
**
** INPUT:
**
** gcoDUMP Dump
** Pointer to a gcoDUMP object.
**
** gctINT32 Width, Height
** Width and height of the surface.
**
** gceSURF_FORMAT PixelFormat
** Pixel format for the surface.
**
** gctUINT32 Address
** Physical address to be used as a handle for the surface.
**
** gctSIZE_T ByteCount
** Number of bytes inside the surface.
**
** OUTPUT:
**
** Nothing.
*/
gceSTATUS
gcoDUMP_AddSurface(
IN gcoDUMP Dump,
IN gctINT32 Width,
IN gctINT32 Height,
IN gceSURF_FORMAT PixelFormat,
IN gctUINT32 Address,
IN gctSIZE_T ByteCount
)
{
gceSTATUS status;
gcsDUMP_SURFACE surface;
gcmHEADER_ARG("Dump=0x%x Width=%d Height=%d PixelFormat=%d Address=%x "
"ByteCount=%d",
Dump, Width, Height, PixelFormat, Address, ByteCount);
/* Verify the arguments. */
gcmVERIFY_OBJECT(Dump, gcvOBJ_DUMP);
gcmVERIFY_ARGUMENT(ByteCount > 0);
if (Dump->file == gcvNULL)
{
/* There is no open dump file. */
gcmFOOTER_NO();
return gcvSTATUS_OK;
}
do
{
/* Write the data record. */
surface.type = gcvTAG_SURFACE;
surface.address = Address;
surface.width = (gctINT16) Width;
surface.height = (gctINT16) Height;
surface.format = PixelFormat;
surface.length = ByteCount;
gcmERR_BREAK(
gcoOS_Write(Dump->os, Dump->file, sizeof(surface), &surface));
/* Update the frame length. */
Dump->frameLength += sizeof(surface);
/* Update the file length. */
Dump->length += sizeof(surface);
}
while (gcvFALSE);
/* Return the status. */
gcmFOOTER();
return status;
}
/*******************************************************************************
**
** gcoDUMP_Delete
**
** Mark an address as deleted.
**
** INPUT:
**
** gcoDUMP Dump
** Pointer to a gcoDUMP object.
**
** gctUINT32 Address
** Physical address to delete.
**
** OUTPUT:
**
** Nothing.
*/
gceSTATUS
gcoDUMP_Delete(
IN gcoDUMP Dump,
IN gctUINT32 Address
)
{
gceSTATUS status;
gcsDUMP_DATA header;
gcmHEADER_ARG("Dump=0x%x Address=%x", Dump, Address);
/* Verify the arguments. */
gcmVERIFY_OBJECT(Dump, gcvOBJ_DUMP);
if (Dump->file == gcvNULL)
{
/* There is no open dump file. */
gcmFOOTER_NO();
return gcvSTATUS_OK;
}
do
{
/* Write the delete record. */
header.type = gcvTAG_DELETE;
header.length = 0;
header.address = Address;
gcmERR_BREAK(
gcoOS_Write(Dump->os, Dump->file, sizeof(header), &header));
/* Update the frame length. */
Dump->frameLength += sizeof(header);
/* Update the file length. */
Dump->length += sizeof(header);
}
while (gcvFALSE);
/* Return the status. */
gcmFOOTER();
return status;
}
/*******************************************************************************
** New dump code.
*/
#if gcdDUMP
gceSTATUS
gcfDump(
IN gcoOS Os,
IN gctCONST_STRING Message,
...
)
{
#if gcdDUMP_IN_KERNEL
gcsHAL_INTERFACE iface;
gctUINT offset = 0;
gcmVERIFY_OK(gcoOS_PrintStrVSafe(iface.u.Debug.message,
gcmSIZEOF(iface.u.Debug.message),
&offset,
Message,
(gctPOINTER) (&Message + 1)));
iface.command = gcvHAL_DEBUG;
iface.u.Debug.set = gcvFALSE;
gcmVERIFY_OK(gcoOS_DeviceControl(Os,
IOCTL_GCHAL_INTERFACE,
&iface, gcmSIZEOF(iface),
&iface, gcmSIZEOF(iface)));
#else
char buffer[80];
gctUINT offset = 0;
gcmVERIFY_OK(gcoOS_PrintStrVSafe(buffer, gcmSIZEOF(buffer),
&offset,
Message,
(gctPOINTER) (&Message + 1)));
gcoOS_Print(buffer);
#endif
return gcvSTATUS_OK;
}
gceSTATUS
gcfDumpData(
IN gcoOS Os,
IN gctSTRING Tag,
IN gctPOINTER Logical,
IN gctSIZE_T Bytes
)
{
gctUINT32_PTR ptr = (gctUINT32_PTR) Logical;
gctSIZE_T bytes = gcmALIGN(Bytes, 4);
while (bytes >= 16)
{
gcmDUMP(Os,
" 0x%08X 0x%08X 0x%08X 0x%08X",
ptr[0], ptr[1], ptr[2], ptr[3]);
ptr += 4;
bytes -= 16;
}
switch (bytes)
{
case 12:
gcmDUMP(Os, " 0x%08X 0x%08X 0x%08X", ptr[0], ptr[1], ptr[2]);
break;
case 8:
gcmDUMP(Os, " 0x%08X 0x%08X", ptr[0], ptr[1]);
break;
case 4:
gcmDUMP(Os, " 0x%08X", ptr[0]);
break;
}
gcmDUMP(Os, "] -- %s", Tag);
return gcvSTATUS_OK;
}
gceSTATUS
gcfDumpBuffer(
IN gcoOS Os,
IN gctSTRING Tag,
IN gctUINT32 Physical,
IN gctPOINTER Logical,
IN gctUINT32 Offset,
IN gctSIZE_T Bytes
)
{
gctUINT32_PTR ptr = (gctUINT32_PTR) Logical + (Offset >> 2);
gctSIZE_T bytes = gcmALIGN(Bytes + (Offset & 3), 4);
gcmDUMP(Os, "@[%s 0x%08X 0x%08X", Tag, Physical + (Offset & ~3), bytes);
while (bytes >= 16)
{
gcmDUMP(Os, " 0x%08X 0x%08X 0x%08X 0x%08X",
ptr[0], ptr[1], ptr[2], ptr[3]);
ptr += 4;
bytes -= 16;
}
switch (bytes)
{
case 12:
gcmDUMP(Os, " 0x%08X 0x%08X 0x%08X", ptr[0], ptr[1], ptr[2]);
break;
case 8:
gcmDUMP(Os, " 0x%08X 0x%08X", ptr[0], ptr[1]);
break;
case 4:
gcmDUMP(Os, " 0x%08X", ptr[0]);
break;
}
gcmDUMP(Os, "] -- %s", Tag);
return gcvSTATUS_OK;
}
#else
gceSTATUS
gcfDump(
IN gcoOS Os,
IN gctCONST_STRING Message,
...
)
{
return gcvSTATUS_OK;
}
#endif
gceSTATUS
gcfDumpApi(
IN gctCONST_STRING Message,
...
)
{
#if gcdDUMP_API
char buffer[80];
gctUINT offset = 0;
gcmVERIFY_OK(gcoOS_PrintStrVSafe(buffer, gcmSIZEOF(buffer),
&offset,
Message,
(gctPOINTER) (&Message + 1)));
gcoOS_Print(buffer);
#endif
return gcvSTATUS_OK;
}
gceSTATUS
gcfDumpArray(
IN gctCONST_POINTER Data,
IN gctUINT32 Size
)
{
#if gcdDUMP_API
const gctUINT32_PTR data = (gctUINT32_PTR) Data;
if (Size > 0)
{
if (Data == gcvNULL)
{
gcfDumpApi(" <nil>");
}
else
{
gctUINT index;
for (index = 0; index < Size;)
{
switch (Size - index)
{
case 1:
gcfDumpApi(" 0x%08X", data[index]);
index += 1;
break;
case 2:
gcfDumpApi(" 0x%08X 0x%08X", data[index], data[index + 1]);
index += 2;
break;
case 3:
gcfDumpApi(" 0x%08X 0x%08X 0x%08X",
data[index], data[index + 1], data[index + 2]);
index += 3;
break;
default:
gcfDumpApi(" 0x%08X 0x%08X 0x%08X 0x%08X",
data[index], data[index + 1], data[index + 2],
data[index + 3]);
index += 4;
break;
}
}
}
}
#endif
return gcvSTATUS_OK;
}
gceSTATUS
gcfDumpArrayToken(
IN gctCONST_POINTER Data,
IN gctUINT32 Termination
)
{
#if gcdDUMP_API
const gctUINT32_PTR data = (gctUINT32_PTR) Data;
if (Data == gcvNULL)
{
gcfDumpApi(" <nil>");
}
else
{
gctUINT index;
for (index = 0; data[index] != Termination; index += 2)
{
gcfDumpApi(" 0x%08X 0x%08X", data[index], data[index + 1]);
}
gcfDumpApi(" 0x%08X", Termination);
}
#endif
return gcvSTATUS_OK;
}

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More