Compare commits

..

No commits in common. "pie" and "nougat" have entirely different histories.
pie ... nougat

29 changed files with 219 additions and 591 deletions

View file

@ -521,7 +521,6 @@ static int do_output_standby(struct sunxi_stream_out *out);
/* The enable flag when 0 makes the assumption that enums are disabled by
* "Off" and integers/booleans by 0 */
#if 0
static int set_route_by_array(struct mixer *mixer, struct route_setting *route,
int enable)
{
@ -554,7 +553,6 @@ static int set_route_by_array(struct mixer *mixer, struct route_setting *route,
return 0;
}
#endif
static int bt_start_call(struct sunxi_audio_device *adev)
{
@ -891,7 +889,6 @@ static void select_mode(struct sunxi_audio_device *adev)
}
#if 0
static int i2s_suspend_get()
{
int ret = -1, fd = 0;
@ -969,9 +966,10 @@ static int check_hdmi_status()
}
return switch_to_hdmi;
}
#endif
static void select_device(struct sunxi_audio_device *adev)
{
int ret = -1;
int output_device_id = 0;
int input_device_id = 0;
const char *output_route = NULL;
@ -1338,6 +1336,7 @@ static int check_input_parameters(uint32_t sample_rate, int format, int channel_
static size_t get_input_buffer_size(uint32_t sample_rate, int format, int channel_count)
{
size_t size;
size_t device_rate;
if (check_input_parameters(sample_rate, format, channel_count) != 0)
return 0;
@ -1388,7 +1387,6 @@ static struct echo_reference_itfe *get_echo_reference(struct sunxi_audio_device
uint32_t channel_count,
uint32_t sampling_rate)
{
(void)format;
put_echo_reference(adev, adev->echo_reference);
if (adev->active_output != NULL) {
struct audio_stream *stream = &adev->active_output->stream.common;
@ -1415,7 +1413,7 @@ static int get_playback_delay(struct sunxi_stream_out *out,
size_t kernel_frames;
int status;
status = pcm_get_htimestamp(out->pcm, (unsigned int*)&kernel_frames, &buffer->time_stamp);
status = pcm_get_htimestamp(out->pcm, &kernel_frames, &buffer->time_stamp);
if (status < 0) {
buffer->time_stamp.tv_sec = 0;
buffer->time_stamp.tv_nsec = 0;
@ -1444,6 +1442,7 @@ static int out_get_presentation_position(const struct audio_stream_out *stream,
pthread_mutex_lock(&out->lock);
int i;
// There is a question how to implement this correctly when there is more than one PCM stream.
// We are just interested in the frames pending for playback in the kernel buffer here,
// not the total played since start. The current behavior should be safe because the
@ -1451,7 +1450,7 @@ static int out_get_presentation_position(const struct audio_stream_out *stream,
//for (i = 0; i < PCM_TOTAL; i++)
if (out->pcm) {
size_t avail;
if (pcm_get_htimestamp(out->pcm, (unsigned int *)&avail, timestamp) == 0) {
if (pcm_get_htimestamp(out->pcm, &avail, timestamp) == 0) {
size_t kernel_buffer_size = out->config.period_size * out->config.period_count;
// FIXME This calculation is incorrect if there is buffering after app processor
int64_t signed_frames = out->written - kernel_buffer_size + avail;
@ -1470,14 +1469,11 @@ static int out_get_presentation_position(const struct audio_stream_out *stream,
static uint32_t out_get_sample_rate(const struct audio_stream *stream)
{
(void)stream;
return DEFAULT_OUT_SAMPLING_RATE;
}
static int out_set_sample_rate(struct audio_stream *stream, uint32_t rate)
{
(void)stream;
(void)rate;
return 0;
}
@ -1490,25 +1486,21 @@ static size_t out_get_buffer_size(const struct audio_stream *stream)
be a multiple of 16 frames */
size_t size = (SHORT_PERIOD_SIZE * DEFAULT_OUT_SAMPLING_RATE) / out->config.rate;
size = ((size + 15) / 16) * 16;
return size * audio_stream_out_frame_size((struct audio_stream_out *)stream);
return size * audio_stream_frame_size((struct audio_stream *)stream);
}
static audio_channel_mask_t out_get_channels(const struct audio_stream *stream)
{
(void)stream;
return AUDIO_CHANNEL_OUT_STEREO;
}
static audio_format_t out_get_format(const struct audio_stream *stream)
{
(void)stream;
return AUDIO_FORMAT_PCM_16_BIT;
}
static int out_set_format(struct audio_stream *stream, audio_format_t format)
{
(void)stream;
(void)format;
return 0;
}
@ -1551,8 +1543,6 @@ static int out_standby(struct audio_stream *stream)
static int out_dump(const struct audio_stream *stream, int fd)
{
(void)stream;
(void)fd;
return 0;
}
@ -1562,6 +1552,7 @@ static int out_set_parameters(struct audio_stream *stream, const char *kvpairs)
struct sunxi_audio_device *adev = out->dev;
struct sunxi_stream_in *in;
struct str_parms *parms;
char *str;
char value[32];
int ret, val = 0;
bool force_input_standby = false;
@ -1613,7 +1604,7 @@ static int out_set_parameters(struct audio_stream *stream, const char *kvpairs)
pthread_mutex_unlock(&adev->lock);
}
ret = str_parms_get_str(parms, "raw_data_output", value, sizeof(value));
ret = str_parms_get_str(parms, AUDIO_PARAMETER_RAW_DATA_OUT, value, sizeof(value));
if (ret >= 0) {
bool bval = (atoi(value) == 1) ? true : false;
ALOGV("AUDIO_PARAMETER_RAW_DATA_OUT: %d", bval);
@ -1633,8 +1624,6 @@ static int out_set_parameters(struct audio_stream *stream, const char *kvpairs)
static char * out_get_parameters(const struct audio_stream *stream, const char *keys)
{
(void)stream;
(void)keys;
return strdup("");
}
@ -1648,9 +1637,6 @@ static uint32_t out_get_latency(const struct audio_stream_out *stream)
static int out_set_volume(struct audio_stream_out *stream, float left,
float right)
{
(void)stream;
(void)left;
(void)right;
return -ENOSYS;
}
@ -1660,11 +1646,12 @@ static ssize_t out_write(struct audio_stream_out *stream, const void* buffer,
int ret;
struct sunxi_stream_out *out = (struct sunxi_stream_out *)stream;
struct sunxi_audio_device *adev = out->dev;
size_t frame_size = audio_stream_out_frame_size((struct audio_stream_out*)&out->stream.common);
size_t frame_size = audio_stream_frame_size(&out->stream.common);
size_t in_frames = bytes / frame_size;
size_t out_frames = RESAMPLER_BUFFER_SIZE / frame_size;
bool force_input_standby = false;
struct sunxi_stream_in *in;
int kernel_frames;
void *buf;
if (adev->mode == AUDIO_MODE_IN_CALL || adev->mode == AUDIO_MODE_MODE_FACTORY_TEST || adev->mode == AUDIO_MODE_FM) {
@ -1679,7 +1666,7 @@ static ssize_t out_write(struct audio_stream_out *stream, const void* buffer,
return 0;
}
if (last_communication_is_bt && (adev->mode != AUDIO_MODE_IN_COMMUNICATION || (adev->mode == AUDIO_MODE_IN_COMMUNICATION && adev->out_device!=AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET))) {
if (last_communication_is_bt && (adev->mode != AUDIO_MODE_IN_COMMUNICATION || adev->mode == AUDIO_MODE_IN_COMMUNICATION && adev->out_device!=AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET)) {
pcm_stop(adev->pcm_modem_dl);
pcm_stop(adev->pcm_modem_ul);
pcm_close(adev->pcm_modem_dl);
@ -1764,7 +1751,7 @@ exit:
pthread_mutex_unlock(&out->lock);
if (ret != 0) {
usleep(bytes * 1000000 / audio_stream_out_frame_size((struct audio_stream_out*)&stream->common) /
usleep(bytes * 1000000 / audio_stream_frame_size(&stream->common) /
out_get_sample_rate(&stream->common));
}
@ -1785,30 +1772,22 @@ exit:
static int out_get_render_position(const struct audio_stream_out *stream,
uint32_t *dsp_frames)
{
(void)stream;
(void)dsp_frames;
return -EINVAL;
}
static int out_add_audio_effect(const struct audio_stream *stream, effect_handle_t effect)
{
(void)stream;
(void)effect;
return 0;
}
static int out_remove_audio_effect(const struct audio_stream *stream, effect_handle_t effect)
{
(void)stream;
(void)effect;
return 0;
}
static int out_get_next_write_timestamp(const struct audio_stream_out *stream,
int64_t *timestamp)
{
(void)stream;
(void)timestamp;
return -EINVAL;
}
@ -1930,8 +1909,6 @@ static uint32_t in_get_sample_rate(const struct audio_stream *stream)
static int in_set_sample_rate(struct audio_stream *stream, uint32_t rate)
{
(void)stream;
(void)rate;
return 0;
}
@ -1957,14 +1934,11 @@ static audio_channel_mask_t in_get_channels(const struct audio_stream *stream)
static audio_format_t in_get_format(const struct audio_stream *stream)
{
(void)stream;
return AUDIO_FORMAT_PCM_16_BIT;
}
static int in_set_format(struct audio_stream *stream, audio_format_t format)
{
(void)stream;
(void)format;
return 0;
}
@ -2014,8 +1988,6 @@ static int in_standby(struct audio_stream *stream)
static int in_dump(const struct audio_stream *stream, int fd)
{
(void)stream;
(void)fd;
return 0;
}
@ -2024,6 +1996,7 @@ static int in_set_parameters(struct audio_stream *stream, const char *kvpairs)
struct sunxi_stream_in *in = (struct sunxi_stream_in *)stream;
struct sunxi_audio_device *adev = in->dev;
struct str_parms *parms;
char *str;
char value[128];
int ret, val = 0;
bool do_standby = false;
@ -2070,18 +2043,14 @@ static int in_set_parameters(struct audio_stream *stream, const char *kvpairs)
static char * in_get_parameters(const struct audio_stream *stream,
const char *keys)
{
(void)stream;
(void)keys;
return strdup("");
}
static int in_set_gain(struct audio_stream_in *stream, float gain)
{
(void)stream;
(void)gain;
return 0;
}
#if 0
static void get_capture_delay(struct sunxi_stream_in *in,
size_t frames,
struct echo_reference_buffer *buffer)
@ -2127,6 +2096,7 @@ static void get_capture_delay(struct sunxi_stream_in *in,
kernel_delay, buf_delay, rsmp_delay, kernel_frames,
in->frames_in, in->proc_frames_in, frames);
}
static int32_t update_echo_reference(struct sunxi_stream_in *in, size_t frames)
{
struct echo_reference_buffer b;
@ -2159,6 +2129,7 @@ static int32_t update_echo_reference(struct sunxi_stream_in *in, size_t frames)
return b.delay_ns;
}
static int set_preprocessor_param(effect_handle_t handle,
effect_param_t *param)
{
@ -2177,6 +2148,7 @@ static int set_preprocessor_param(effect_handle_t handle,
return status;
}
static int set_preprocessor_echo_delay(effect_handle_t handle,
int32_t delay_us)
{
@ -2222,7 +2194,7 @@ static void push_echo_reference(struct sunxi_stream_in *in, size_t frames)
in->ref_frames_in * in->config.channels * sizeof(int16_t));
}
}
#endif
static int get_next_buffer(struct resampler_buffer_provider *buffer_provider,
struct resampler_buffer* buffer)
{
@ -2245,7 +2217,7 @@ static int get_next_buffer(struct resampler_buffer_provider *buffer_provider,
in->read_status = pcm_read(in->pcm,
(void*)in->buffer,
in->config.period_size *
audio_stream_in_frame_size((struct audio_stream_in*)&in->stream.common));
audio_stream_frame_size(&in->stream.common));
if (in->read_status != 0) {
ALOGE("get_next_buffer() pcm_read error %d, %s", in->read_status, strerror(errno));
buffer->raw = NULL;
@ -2289,19 +2261,19 @@ static ssize_t read_frames(struct sunxi_stream_in *in, void *buffer, ssize_t fra
if (in->resampler != NULL) {
in->resampler->resample_from_provider(in->resampler,
(int16_t *)((char *)buffer +
frames_wr * audio_stream_in_frame_size((struct audio_stream_in*)&in->stream.common)),
frames_wr * audio_stream_frame_size(&in->stream.common)),
&frames_rd);
} else {
struct resampler_buffer buf = {
{ .raw = NULL, },
.frame_count = frames_rd,
{ raw : NULL, },
frame_count : frames_rd,
};
get_next_buffer(&in->buf_provider, &buf);
if (buf.raw != NULL) {
memcpy((char *)buffer +
frames_wr * audio_stream_in_frame_size((struct audio_stream_in*)&in->stream.common),
frames_wr * audio_stream_frame_size(&in->stream.common),
buf.raw,
buf.frame_count * audio_stream_in_frame_size((struct audio_stream_in*)&in->stream.common));
buf.frame_count * audio_stream_frame_size(&in->stream.common));
frames_rd = buf.frame_count;
}
release_buffer(&in->buf_provider, &buf);
@ -2316,7 +2288,7 @@ static ssize_t read_frames(struct sunxi_stream_in *in, void *buffer, ssize_t fra
}
return frames_wr;
}
#if 0
/* process_frames() reads frames from kernel driver (via read_frames()),
* calls the active audio pre processings and output the number of frames requested
* to the buffer specified */
@ -2384,14 +2356,14 @@ static ssize_t process_frames(struct sunxi_stream_in *in, void* buffer, ssize_t
}
return frames_wr;
}
#endif
static ssize_t in_read(struct audio_stream_in *stream, void* buffer,
size_t bytes)
{
int ret = 0;
struct sunxi_stream_in *in = (struct sunxi_stream_in *)stream;
struct sunxi_audio_device *adev = in->dev;
size_t frames_rq = bytes / audio_stream_in_frame_size((struct audio_stream_in *)&stream->common);
size_t frames_rq = bytes / audio_stream_frame_size(&stream->common);
int is_first_data = 0;
if (adev->mode == AUDIO_MODE_IN_CALL) {
@ -2470,7 +2442,7 @@ static ssize_t in_read(struct audio_stream_in *stream, void* buffer,
exit:
if (ret < 0)
usleep(bytes * 1000000 / audio_stream_in_frame_size((struct audio_stream_in*)&stream->common) /
usleep(bytes * 1000000 / audio_stream_frame_size(&stream->common) /
in_get_sample_rate(&stream->common));
pthread_mutex_unlock(&in->lock);
@ -2479,7 +2451,6 @@ exit:
static uint32_t in_get_input_frames_lost(struct audio_stream_in *stream)
{
(void)stream;
return 0;
}
@ -2568,12 +2539,8 @@ static int adev_open_output_stream(struct audio_hw_device *dev,
audio_devices_t devices,
audio_output_flags_t flags,
struct audio_config *config,
struct audio_stream_out **stream_out,
const char *address)
struct audio_stream_out **stream_out)
{
(void)handle;
(void)devices;
(void)address;
struct sunxi_audio_device *ladev = (struct sunxi_audio_device *)dev;
struct sunxi_stream_out *out;
int ret;
@ -2628,6 +2595,7 @@ static int adev_open_output_stream(struct audio_hw_device *dev,
return 0;
err_open:
free(out);
*stream_out = NULL;
return ret;
@ -2636,7 +2604,6 @@ static int adev_open_output_stream(struct audio_hw_device *dev,
static void adev_close_output_stream(struct audio_hw_device *dev,
struct audio_stream_out *stream)
{
(void)dev;
struct sunxi_stream_out *out = (struct sunxi_stream_out *)stream;
struct sunxi_audio_device *adev = out->dev;
@ -2661,6 +2628,7 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs)
{
struct sunxi_audio_device *adev = (struct sunxi_audio_device *)dev;
struct str_parms *parms;
char *str;
char value[32];
int ret;
@ -2708,7 +2676,6 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs)
static char * adev_get_parameters(const struct audio_hw_device *dev,
const char *keys)
{
(void)dev;
if (!strcmp(keys, "routing"))
{
char prop_value[512];
@ -2722,7 +2689,6 @@ static char * adev_get_parameters(const struct audio_hw_device *dev,
static int adev_init_check(const struct audio_hw_device *dev)
{
(void)dev;
return 0;
}
@ -2738,6 +2704,7 @@ static int adev_set_voice_volume(struct audio_hw_device *dev, float volume)
} else if (adev->mode == AUDIO_MODE_IN_CALL) {
int level;
int speaker_on=0,headset_on=0 ,headphone_on=0,earpiece_on=0;
int speaker_vol=0, headset_vol=0, earpiece_vol=0;
int volume_codec = (int)(volume*100/10);
speaker_on = adev->out_device & AUDIO_DEVICE_OUT_SPEAKER;
headset_on = adev->out_device & AUDIO_DEVICE_OUT_WIRED_HEADSET; // with mic
@ -2778,23 +2745,19 @@ static int adev_set_voice_volume(struct audio_hw_device *dev, float volume)
}
return 0;
}
#if 0
static int adev_set_master_volume(struct audio_hw_device *dev, float volume)
{
(void)dev;
(void)volume;
F_LOG;
return -ENOSYS;
}
static int adev_get_master_volume(struct audio_hw_device *dev, float *volume)
{
(void)dev;
(void)volume;
F_LOG;
return -ENOSYS;
}
#endif
static int adev_set_mode(struct audio_hw_device *dev, audio_mode_t mode)
{
struct sunxi_audio_device *adev = (struct sunxi_audio_device *)dev;
@ -2830,7 +2793,7 @@ static int adev_get_mic_mute(const struct audio_hw_device *dev, bool *state)
static size_t adev_get_input_buffer_size(const struct audio_hw_device *dev,
const struct audio_config *config)
{
(void)dev;
size_t size;
int channel_count = popcount(config->channel_mask);
if (check_input_parameters(config->sample_rate, config->format, channel_count) != 0)
return 0;
@ -2842,16 +2805,8 @@ static int adev_open_input_stream(struct audio_hw_device *dev,
audio_io_handle_t handle,
audio_devices_t devices,
struct audio_config *config,
struct audio_stream_in **stream_in,
audio_input_flags_t flags,
const char* addr,
audio_source_t source)
struct audio_stream_in **stream_in)
{
(void)handle;
(void)dev;
(void)flags;
(void)addr;
(void)source;
struct sunxi_audio_device *ladev = (struct sunxi_audio_device *)dev;
struct sunxi_stream_in *in;
int ret;
@ -2890,16 +2845,16 @@ static int adev_open_input_stream(struct audio_hw_device *dev,
//in->config.in_init_channels = channel_count;
ALOGV("to malloc in-buffer: period_size: %d, frame_size: %d",
in->config.period_size, (int)audio_stream_in_frame_size((struct audio_stream_in*)&in->stream.common));
in->config.period_size, audio_stream_frame_size(&in->stream.common));
in->buffer = malloc(in->config.period_size *
audio_stream_in_frame_size((struct audio_stream_in*)&in->stream.common) * 8);
audio_stream_frame_size(&in->stream.common) * 8);
if (!in->buffer) {
ret = -ENOMEM;
goto err;
}
memset(in->buffer, 0, in->config.period_size *
audio_stream_in_frame_size((struct audio_stream_in*)&in->stream.common) * 8); //mute
audio_stream_frame_size(&in->stream.common) * 8); //mute
ladev->af_capture_flag = false;
//devices = AUDIO_DEVICE_IN_WIFI_DISPLAY;//for test
@ -2981,43 +2936,29 @@ int adev_create_audio_patch(struct audio_hw_device *dev,
const struct audio_port_config *sinks,
audio_patch_handle_t *handle)
{
(void)dev;
(void)num_sources;
(void)sources;
(void)num_sinks;
(void)sinks;
(void)handle;
return 0;
}
int adev_release_audio_patch(struct audio_hw_device *dev,
audio_patch_handle_t handle)
{
(void)dev;
(void)handle;
return 0;
}
int adev_get_audio_port(struct audio_hw_device *dev,
struct audio_port *port)
{
(void)dev;
(void)port;
return 0;
}
int adev_set_audio_port_config(struct audio_hw_device *dev,
const struct audio_port_config *config)
{
(void)dev;
(void)config;
return 0;
}
static int adev_dump(const audio_hw_device_t *device, int fd)
{
(void)device;
(void)fd;
return 0;
}
@ -3095,6 +3036,7 @@ static int adev_open(const hw_module_t* module, const char* name,
hw_device_t** device)
{
struct sunxi_audio_device *adev;
int ret;
if (strcmp(name, AUDIO_HARDWARE_INTERFACE) != 0)
return -EINVAL;
@ -3170,6 +3112,7 @@ static int adev_open(const hw_module_t* module, const char* name,
return 0;
error_out:
free(adev);
return -EINVAL;
}

View file

@ -36,7 +36,6 @@ void codec_dev_exit()
//normal play and record
void normal_play_enable(bool enable)
{
(void)enable;
// init volume
//disable other mode
}
@ -79,7 +78,7 @@ void normal_record_route(int path)
//FM play and record
void fm_play_enable(bool enable){
(void)enable;
}
@ -116,7 +115,7 @@ void fm_volume(int path,int volume)
//Factory test
void factory_enable(bool enable){
(void)enable;
}
void factory_route(int path){
@ -128,15 +127,15 @@ void factory_route(int path){
//Ringtone
void ringtone_enable(bool enable){
(void)enable;
}
void ringtone_path(int path){
(void)path;
}
void ringtone_volume(float volume){
(void)volume;
}
void clear_phone_route()
@ -149,7 +148,7 @@ void clear_phone_route()
//phone play and record
void phone_play_enable(bool enable){
(void)enable;
}
void phone_play_route(int path)

View file

@ -19,8 +19,6 @@
static int set_normal_volume(struct codec_client *client, int path, int vol)
{
(void)client;
(void)vol;
int headset_on=0, headphone_on=0, speaker_on=0;
headset_on = path & AUDIO_DEVICE_OUT_WIRED_HEADSET; // hp4p
@ -42,6 +40,7 @@ static int set_normal_path(struct codec_client *client, int path)
{
int switch_to_headset =0;
int ret = -1, fd=0;
char prop_value[20]={0};
char h2w_state[2]={0};
int headset_on=0, headphone_on=0, speaker_on=0, earpiece_on=0;
@ -124,8 +123,6 @@ static int set_normal_path(struct codec_client *client, int path)
static int set_normal_record_enable(struct codec_client *client, bool enable)
{
(void)client;
(void)enable;
//mixer_ctl_set_value(client->mixer_ctls->audio_linein_record, 0, 0);
//mixer_ctl_set_value(client->mixer_ctls->audio_phone_voice_record, 0, 0);
ALOGV("normal record mode 4,****LINE:%d,FUNC:%s",__LINE__,__FUNCTION__);
@ -168,9 +165,11 @@ static int set_normal_record(struct codec_client *client, int path)
}
static int mixer_vol[]={0,1,2,3,4,5,6,7}; //0~15
static int spk_vol[]={16,18,21,23,25,26,28,30}; //0~31
static int hp_vol[]={40,44,48,50,52,56,58,61}; //0~62
static int set_fm_volume(struct codec_client *client, int path, int volume)
{
(void)client;
int speaker_on=0,headset_on=0 ,headphone_on=0;
int speaker_vol=0, headset_vol=0;
int val = 0;
@ -218,7 +217,6 @@ static int set_fm_volume(struct codec_client *client, int path, int volume)
static int set_fm_path(struct codec_client *client, int path)
{
(void)client;
int headset_on=0, headphone_on=0, speaker_on=0;
headset_on = path & AUDIO_DEVICE_OUT_WIRED_HEADSET; // hp4p
@ -240,7 +238,6 @@ static int set_fm_path(struct codec_client *client, int path)
}
static int set_fm_record_enable(struct codec_client *client, bool enable)
{
(void)client;
//mixer_ctl_set_value(client->mixer_ctls->audio_phone_voice_record, 0, 0);
if (enable){
@ -254,8 +251,6 @@ static int set_fm_record_enable(struct codec_client *client, bool enable)
static int set_fm_record(struct codec_client *client, int path)
{
(void)client;
(void)path;
ALOGV("FM record mode 4, ****LINE:%d,FUNC:%s", __LINE__,__FUNCTION__);
return 0;
}

View file

@ -197,7 +197,10 @@ int plan_one_mixer_buf(char *buf, int bytes)
int plan_one_start_bt_record(void)
{
int ret;
int record_size=0;
char *record_buf = NULL;
int i=0,ret;
struct list_buf *new;
memset(&(record_data), 0, sizeof(struct record_data));
@ -374,6 +377,7 @@ static int stream_transfer(struct stream_transfer *stream_transfer)
struct dev_stream *stream_receiver;
int size_transfer = 0;
int ret =0;
int exit_flag =0;
int i =0;
short* Srcptr;
short* Drcptr;
@ -384,7 +388,7 @@ static int stream_transfer(struct stream_transfer *stream_transfer)
#ifdef START_ZERO_BUFFER
/* ??????ͷ???? */
/* 消除开头杂音 */
memset(stream_sender->buf, 0, stream_sender->buf_size);
pcm_write(stream_receiver->dev, stream_sender->buf, stream_sender->buf_size);
#endif
@ -431,7 +435,7 @@ static int stream_transfer(struct stream_transfer *stream_transfer)
}
if (stream_transfer->record_flag == 1){
//??????,????????.
//是上行,还是下行.
if (stream_transfer->voice_direction == UPSTREAM){
Srcptr = (short*)(stream_sender->buf);
Drcptr = (short*)(record_data.record_buf + (record_data.lenwriteup%record_data.record_lenth));

View file

@ -17,12 +17,11 @@
#include "plan_one.h"
static int no_earpiece = 0;
static bool last_path_is_bt = false ;
static bool end_call = false;
static int set_normal_volume(struct codec_client *client, int path, int vol)
{
(void)client;
(void)vol;
int headset_on=0, headphone_on=0, speaker_on=0;
headset_on = path & AUDIO_DEVICE_OUT_WIRED_HEADSET; // hp4p
@ -42,9 +41,9 @@ static int set_normal_volume(struct codec_client *client, int path, int vol)
static int set_normal_path(struct codec_client *client, int path)
{
(void)client;
int switch_to_headset =0;
int ret = -1, fd=0;
char prop_value[20]={0};
char h2w_state[2]={0};
int headset_on=0, headphone_on=0, speaker_on=0, earpiece_on=0;
@ -95,8 +94,6 @@ ALOGV("huangxin---------------------------%d,%s,path:%d, headset_on:%d, headphon
static int set_normal_record_enable(struct codec_client *client, bool enable)
{
(void)client;
(void)enable;
//mixer_ctl_set_value(client->mixer_ctls->audio_linein_record, 0, 0);
//mixer_ctl_set_value(client->mixer_ctls->audio_phone_voice_record, 0, 0);
ALOGV("normal record mode 4,****LINE:%d,FUNC:%s",__LINE__,__FUNCTION__);
@ -105,7 +102,6 @@ static int set_normal_record_enable(struct codec_client *client, bool enable)
static int set_normal_record(struct codec_client *client, int path)
{
(void)client;
ALOGV("normal record mode 4,****LINE:%d,FUNC:%s",__LINE__,__FUNCTION__);
int headset_on=0;
headset_on = path & AUDIO_DEVICE_IN_WIRED_HEADSET;
@ -121,7 +117,6 @@ static int set_normal_record(struct codec_client *client, int path)
static int set_fm_volume(struct codec_client *client, int path, int volume)
{
(void)client;
int speaker_on=0,headset_on=0 ,headphone_on=0;
int level;
@ -158,7 +153,6 @@ static int set_fm_volume(struct codec_client *client, int path, int volume)
static int fm_last_dev=0; // 1 = speaker, 2= headset;
static int set_fm_path(struct codec_client *client, int path)
{
(void)client;
int headset_on=0, headphone_on=0, speaker_on=0;
headset_on = path & AUDIO_DEVICE_OUT_WIRED_HEADSET; // hp4p
@ -196,7 +190,6 @@ static int set_fm_path(struct codec_client *client, int path)
}
static int set_fm_record_enable(struct codec_client *client, bool enable)
{
(void)client;
//mixer_ctl_set_value(client->mixer_ctls->audio_phone_voice_record, 0, 0);
if (enable){
@ -210,8 +203,6 @@ static int set_fm_record_enable(struct codec_client *client, bool enable)
static int set_fm_record(struct codec_client *client, int path)
{
(void)client;
(void)path;
#if 0
int headset_on=0, headphone_on=0, speaker_on=0;
@ -235,17 +226,12 @@ static int set_fm_record(struct codec_client *client, int path)
static int set_factory_volume(struct codec_client *client, int path, int vol)
{
(void)client;
(void)path;
(void)vol;
ALOGV("****LINE:%d,FUNC:%s",__LINE__,__FUNCTION__);
return 0;
}
static int set_factory_path(struct codec_client *client, int path)
{
(void)client;
(void)path;
#if 0
mixer_ctl_set_value(client->mixer_ctls->audio_phone_end_call, 0, 1);
@ -283,9 +269,9 @@ static int set_factory_path(struct codec_client *client, int path)
static int set_phone_volume(struct codec_client *client, int path, int volume)
{
(void)client;
int level;
int speaker_on=0,headset_on=0 ,headphone_on=0,earpiece_on=0;
int speaker_vol=0, headset_vol=0, earpiece_vol=0;
speaker_on = path & AUDIO_DEVICE_OUT_SPEAKER;
headset_on = path & AUDIO_DEVICE_OUT_WIRED_HEADSET; // with mic
@ -328,11 +314,13 @@ static int set_phone_volume(struct codec_client *client, int path, int volume)
static bool is_in_record = false;
static bool bluetooth_in_record = false;
static int set_phone_path(struct codec_client *client, int path)
{
(void)client;
int ret = -1;
int earpiece_on=0, headset_on=0, headphone_on=0, bt_on=0, speaker_on=0;
int pa_should_on=0;
headset_on = path & AUDIO_DEVICE_OUT_WIRED_HEADSET; // hp4p
headphone_on = path & AUDIO_DEVICE_OUT_WIRED_HEADPHONE; // hp3p
@ -430,8 +418,8 @@ ALOGV("huangxin----****LINE:%d,FUNC:%s,headset_on:%d, headphone_on:%d, speaker_o
ALOGV("in bluetooth ****LINE:%d,FUNC:%s",__LINE__,__FUNCTION__);
mixer_ctl_set_value(client->mixer_ctls->audio_bt_clk_fmt, 0, 1);
/*
* ????: analog_bt_mic->analog_phoneout
* ????: analog_bt_phonein->bt_out
* : analog_bt_mic->analog_phoneout
* : analog_bt_phonein->bt_out
*/
mixer_ctl_set_value(client->mixer_ctls->audio_analog_bt_mic, 0, 1);
mixer_ctl_set_value(client->mixer_ctls->audio_analog_bt_phonein, 0, 1);
@ -450,7 +438,6 @@ ALOGV("huangxin----****LINE:%d,FUNC:%s,headset_on:%d, headphone_on:%d, speaker_o
static int set_phone_record_enable(struct codec_client *client, bool enable)
{
(void)client;
// mixer_ctl_set_value(client->mixer_ctls->audio_linein_record, 0, 0);
if (enable){
@ -468,15 +455,12 @@ static int set_phone_record_enable(struct codec_client *client, bool enable)
static int set_phone_record(struct codec_client *client, int path)
{
(void)client;
(void)path;
ALOGV("****LINE:%d,FUNC:%s",__LINE__,__FUNCTION__);
return 0;
}
static int record_read_pcm_buf(struct codec_client *client, void* buffer, int bytes)
{
(void)client;
ALOGV("1****LINE:%d,FUNC:%s",__LINE__,__FUNCTION__);
return plan_one_mixer_buf(buffer, bytes);
@ -511,7 +495,6 @@ void plan_one_exit(void)
}
static int clean_phone_path (struct codec_client *client)
{
(void)client;
ALOGV("***********%d,********%s********\n", __LINE__,__FUNCTION__);
//mixer_ctl_set_value(client->mixer_ctls->audio_phone_end_call, 0, 1);
end_call = true;

View file

@ -58,6 +58,11 @@ static struct stream_transfer g_bt_download_voice ;
static struct stream_transfer g_bp_upload_voice ;
static struct stream_transfer g_bp_download_voice ;
static void *voice_down_thread(void *param);
static void *voice_up_thread(void *param);
static void *voice_bt_down_thread(void *param);
static void *voice_bt_up_thread(void *param);
static void *manager_thread(void *param);
static void *manage_voice_thread(void *param);
static int stream_transfer(struct stream_transfer *stream_transfer);
@ -164,7 +169,6 @@ int plan_two_stop_voice(void)
int plan_two_start_bt_voice(int up_vol)
{
(void)up_vol;
g_bt_upload_voice.voice_thread_run_flag = 1;
g_bt_download_voice.voice_thread_run_flag = 1;
g_bt_upload_voice.voice_thread_exit_flag = 1;
@ -249,7 +253,9 @@ int plan_two_mixer_buf(char *buf, int bytes)
int plan_two_start_record(void)
{
int record_size=0;
int ret;
char *record_buf = NULL;
int i=0,ret;
struct list_buf *new;
memset(&(record_data), 0, sizeof(struct record_data));
@ -506,6 +512,7 @@ static int stream_transfer(struct stream_transfer *stream_transfer)
short* Drcptr;
int size_transfer = 0;
int ret =0;
int exit_flag =0;
int i=0;
stream_sender = stream_transfer->stream_sender;
@ -514,7 +521,7 @@ static int stream_transfer(struct stream_transfer *stream_transfer)
#ifdef START_ZERO_BUFFER
/* ??????ͷ???? */
/* 消除开头杂音 */
memset(stream_sender->buf, 0, stream_sender->buf_size);
pcm_write(stream_receiver->dev, stream_sender->buf, stream_sender->buf_size);
#endif
@ -527,7 +534,7 @@ static int stream_transfer(struct stream_transfer *stream_transfer)
pcm_start(stream_receiver->dev);
/* ??????ͷpa?? */
/* 消除开头pa音 */
memset(stream_sender->buf, 0, stream_sender->buf_size);
pcm_write(stream_receiver->dev, stream_sender->buf, stream_sender->buf_size);
@ -591,7 +598,7 @@ static int stream_transfer(struct stream_transfer *stream_transfer)
if (stream_transfer->record_flag == 1){
//??????,????????.
//是上行,还是下行.
if (stream_transfer->voice_direction == UPSTREAM){
Srcptr = (short*)(stream_sender->buf);
Drcptr = (short*)(record_data.record_buf + (record_data.lenwriteup%record_data.record_lenth));

View file

@ -18,12 +18,11 @@
#include "plan_two.h"
static bool g_is_bp_thread_running = false;
static int no_earpiece = 0;
static bool end_call = false;
static int set_normal_volume(struct codec_client *client, int path, int vol)
{
(void)client;
(void)vol;
int headset_on=0, headphone_on=0, speaker_on=0;
headset_on = path & AUDIO_DEVICE_OUT_WIRED_HEADSET; // hp4p
@ -41,12 +40,13 @@ static int set_normal_volume(struct codec_client *client, int path, int vol)
return 0;
}
static bool last_path_is_bt = false ;
static int set_normal_path(struct codec_client *client, int path)
{
(void)client;
int switch_to_headset =0;
int ret = -1, fd=0;
char prop_value[20]={0};
char h2w_state[2]={0};
int headset_on=0, headphone_on=0, speaker_on=0, earpiece_on=0,bt_button_voice=0;
@ -94,8 +94,6 @@ ALOGV("in normal mode,****LINE:%d,FUNC:%s",__LINE__,__FUNCTION__);
static int set_normal_record_enable(struct codec_client *client, bool enable)
{
(void)client;
(void)enable;
//mixer_ctl_set_value(client->mixer_ctls->audio_linein_record, 0, 0);
//mixer_ctl_set_value(client->mixer_ctls->audio_phone_voice_record, 0, 0);
ALOGV("normal record mode 4,****LINE:%d,FUNC:%s",__LINE__,__FUNCTION__);
@ -104,7 +102,6 @@ static int set_normal_record_enable(struct codec_client *client, bool enable)
static int set_normal_record(struct codec_client *client, int path)
{
(void)client;
ALOGV("normal record mode 4,****LINE:%d,FUNC:%s",__LINE__,__FUNCTION__);
int headset_on=0;
headset_on = path & AUDIO_DEVICE_IN_WIRED_HEADSET;
@ -119,9 +116,7 @@ static int set_normal_record(struct codec_client *client, int path)
}
static int set_fm_volume(struct codec_client *client, int path, int volume)
{
(void)client;
int speaker_on=0,headset_on=0 ,headphone_on=0;
{ int speaker_on=0,headset_on=0 ,headphone_on=0;
int level;
headset_on = path & AUDIO_DEVICE_OUT_WIRED_HEADSET; // hp4p
@ -156,7 +151,6 @@ static int set_fm_volume(struct codec_client *client, int path, int volume)
static int set_fm_path(struct codec_client *client, int path)
{
(void)client;
int headset_on=0, headphone_on=0, speaker_on=0;
headset_on = path & AUDIO_DEVICE_OUT_WIRED_HEADSET; // hp4p
@ -179,7 +173,6 @@ static int set_fm_path(struct codec_client *client, int path)
}
static int set_fm_record_enable(struct codec_client *client, bool enable)
{
(void)client;
//mixer_ctl_set_value(client->mixer_ctls->audio_phone_voice_record, 0, 0);
if (enable){
@ -193,8 +186,6 @@ static int set_fm_record_enable(struct codec_client *client, bool enable)
static int set_fm_record(struct codec_client *client, int path)
{
(void)client;
(void)path;
ALOGV("FM record mode 4, ****LINE:%d,FUNC:%s", __LINE__,__FUNCTION__);
return 0;
@ -202,17 +193,12 @@ static int set_fm_record(struct codec_client *client, int path)
static int set_factory_volume(struct codec_client *client, int path, int vol)
{
(void)client;
(void)path;
(void)vol;
ALOGV("****LINE:%d,FUNC:%s",__LINE__,__FUNCTION__);
return 0;
}
static int set_factory_path(struct codec_client *client, int path)
{
(void)client;
(void)path;
//mixer_ctl_set_value(client->mixer_ctls->audio_phone_end_call, 0, 1);
//mixer_ctl_set_value(client->mixer_ctls->audio_linein_in, 0, 1);
@ -249,6 +235,7 @@ static int set_phone_volume(struct codec_client *client, int path, int volume)
{
int level;
int speaker_on=0,headset_on=0 ,headphone_on=0,earpiece_on=0;
int speaker_vol=0, headset_vol=0, earpiece_vol=0;
speaker_on = path & AUDIO_DEVICE_OUT_SPEAKER;
headset_on = path & AUDIO_DEVICE_OUT_WIRED_HEADSET; // with mic
@ -294,10 +281,11 @@ static int set_phone_volume(struct codec_client *client, int path, int volume)
}
static bool is_in_record = false;
static bool bluetooth_in_record = false;
static int clean_phone_path (struct codec_client *client)
{
(void)client;
ALOGV("***********%d,********%s********\n", __LINE__,__FUNCTION__);
//mixer_ctl_set_value(client->mixer_ctls->audio_phone_end_call, 0, 1);
end_call = true;
@ -306,8 +294,9 @@ static int set_phone_volume(struct codec_client *client, int path, int volume)
static int set_phone_path(struct codec_client *client, int path)
{
(void)client;
int ret = -1;
int earpiece_on=0, headset_on=0, headphone_on=0, bt_on=0, speaker_on=0;
int pa_should_on=0;
headset_on = path & AUDIO_DEVICE_OUT_WIRED_HEADSET; // hp4p
headphone_on = path & AUDIO_DEVICE_OUT_WIRED_HEADPHONE; // hp3p
@ -428,8 +417,7 @@ static int set_phone_path(struct codec_client *client, int path)
static int set_phone_record_enable(struct codec_client *client, bool enable)
{
(void)client;
(void)enable;
int ret = 0;
#if 0
mixer_ctl_set_value(client->mixer_ctls->audio_linein_record, 0, 0);
@ -449,15 +437,12 @@ static int set_phone_record_enable(struct codec_client *client, bool enable)
static int set_phone_record(struct codec_client *client, int path)
{
(void)client;
(void)path;
ALOGV("****LINE:%d,FUNC:%s",__LINE__,__FUNCTION__);
return 0;
}
static int record_read_pcm_buf(struct codec_client *client, void* buffer, int bytes)
{
(void)client;
ALOGV("1****LINE:%d,FUNC:%s",__LINE__,__FUNCTION__);
return plan_two_mixer_buf(buffer, bytes);

View file

@ -204,6 +204,7 @@ static volatile long int g_total_size = 0;
static void *record_manage_thread(void *param)
{
int ret = 0;
struct record_private *record = (struct record_private*)param;

View file

@ -34,6 +34,7 @@
#define KEY_PHONEPN_GAIN "phonepn_gain"
static void free_int_list(int *p);
static void print_array(int *array, int array_size);
static int *process_line(FILE *fp, int *ret_len);
static void free_int_list(int *p)
@ -43,6 +44,14 @@ static void free_int_list(int *p)
}
}
void print_array(int *array, int array_size)
{
int i = 0;
for(i=0; i< array_size; i++){
ALOGD("array[%d]=%d", i, array[i]);
}
}
static int * process_line(FILE *fp, int *ret_len)
{
char linebuf[MAX_LINE_SZ];
@ -92,7 +101,7 @@ static int * process_line(FILE *fp, int *ret_len)
int get_volume_config(struct volume_array *vol_array)
{
FILE *fp;
char *key_name;
char *key_name, *key_value;
char linebuf[MAX_LINE_SZ];
char *line;
int *val_array=NULL;

View file

@ -13,7 +13,7 @@
#define AT_PATH "/dev/mux2"
//????bp?豸?ڵ?.
//获得bp设备节点.
static int demo_get_tty_dev(char *name)
{
strncpy(name, AT_PATH, strlen(AT_PATH));
@ -22,14 +22,20 @@ static int demo_get_tty_dev(char *name)
}
//????????.?֣???,˳???<3F><>δӵڣ???????????
//声音数组.分6级,顺序依次从第1级到第六级
static int earpiece_vol[]={1,2,3,4,5,6};
static int headset_vol[]={1,2,3,4,5,6};
static int spk_vol[]={1,2,3,4,5,6};
static int bt_vol[]={1,2,3,4,5,6};
static int main_mic_vol[]={1,2,3,4,5,6};
static int headset_mic_vol[]={1,2,3,4,5,6};
//??ͬ·????,???????õ???
//不同路径下,声音设置调用
static int demo_set_call_volume(ril_audio_path_type_t path, int volume)
{
(void)path;
char tty_dev[32]={0};
int level;
char cmdline[30];
int level, bp_vol;
if (volume >= 10) {
@ -78,10 +84,11 @@ static int demo_set_call_volume(ril_audio_path_type_t path, int volume)
return 0;
}
//·???л?????
//路径切换调用
static int demo_set_call_path(ril_audio_path_type_t path)
{
(void)path;
int channel = 0;
char cmdline[50]={0};
char tty_dev[32]={0};
#if 0
@ -143,10 +150,10 @@ static int demo_set_call_path(ril_audio_path_type_t path)
return 0;
}
//????????atָ??
//调用任意at指令
static int demo_set_call_at(char *at)
{
(void)at;
char tty_dev[32]={0};
// demo_get_tty_dev(tty_dev);
//1 exec_at(tty_dev,at);

View file

@ -48,7 +48,6 @@ static int mu509_get_tty_dev(char *name)
static int mu509_set_call_volume(ril_audio_path_type_t path, int volume)
{
(void)path;
char tty_dev[32]={0};
char cmdline[30];
@ -80,6 +79,7 @@ static int mu509_set_call_volume(ril_audio_path_type_t path, int volume)
static int mu509_set_call_path(ril_audio_path_type_t path)
{
int channel = 0;
int audio_loop_en = 1;
char cmdline[50]={0};
char tty_dev[32]={0};
@ -137,7 +137,7 @@ static int mu509_set_call_path(ril_audio_path_type_t path)
sprintf(cmdline, "AT^SWSPATH=%d", channel);
exec_at(tty_dev,cmdline);
ALOGD("channel, cmdline:%s,cmdline:%s", cmdline, cmdline);
ALOGD("channel, cmdline:%s,cmdline:%d", cmdline, cmdline);
// sprintf(cmdline, "AT^ECHO=%d", audio_loop_en);
// ALOGD("audio_loop_en- add sound loop cancel, cmdline:%s,cmdline:%d", cmdline, cmdline);
// exec_at(tty_dev,cmdline);

View file

@ -16,22 +16,18 @@ static char tty_dev[32] = AT_PATH;
static int em55_get_tty_dev(char *name)
{
(void)name;
ALOGD("em55_get_tty_dev\n");
return 0;
}
static int em55_set_call_volume(ril_audio_path_type_t path, int vol)
{
(void)path;
(void)vol;
ALOGD("em55_set_call_volume\n");
return 0;
}
static int em55_set_call_path(ril_audio_path_type_t path)
{
(void)path;
ALOGD("em55_set_call_path\n");
return 0;
}

View file

@ -13,7 +13,7 @@
#define AT_PATH "/dev/ttyS3"
//????bp?豸?ڵ?.
//获得bp设备节点.
static int usi6276_get_tty_dev(char *name)
{
strncpy(name, AT_PATH, strlen(AT_PATH));
@ -22,14 +22,20 @@ static int usi6276_get_tty_dev(char *name)
}
//????????.?֣???,˳???<3F><>δӵڣ???????????
//声音数组.分6级,顺序依次从第1级到第六级
static int earpiece_vol[]={1,2,3,4,5,6};
static int headset_vol[]={1,2,3,4,5,6};
static int spk_vol[]={1,2,3,4,5,6};
static int bt_vol[]={1,2,3,4,5,6};
static int main_mic_vol[]={1,2,3,4,5,6};
static int headset_mic_vol[]={1,2,3,4,5,6};
//??ͬ·????,???????õ???
//不同路径下,声音设置调用
static int usi6276_set_call_volume(ril_audio_path_type_t path, int volume)
{
(void)path;
char tty_dev[32]={0};
int level;
char cmdline[30];
int level, bp_vol;
if (volume >= 10) {
@ -78,10 +84,11 @@ static int usi6276_set_call_volume(ril_audio_path_type_t path, int volume)
return 0;
}
//·???л?????
//路径切换调用
static int usi6276_set_call_path(ril_audio_path_type_t path)
{
(void)path;
int channel = 0;
char cmdline[50]={0};
char tty_dev[32]={0};
#if 0
@ -143,7 +150,7 @@ static int usi6276_set_call_path(ril_audio_path_type_t path)
return 0;
}
//????????atָ??
//调用任意at指令
static int usi6276_set_call_at(char *at)
{
char tty_dev[32]={0};

View file

@ -34,7 +34,7 @@
#define KEY_PHONEPN_GAIN "phonepn_gain"
static void free_int_list(int *p);
//static void print_array(int *array, int array_size);
static void print_array(int *array, int array_size);
static int *process_line(FILE *fp, int *ret_len);
static void free_int_list(int *p)
@ -43,7 +43,7 @@ static void free_int_list(int *p)
free(p);
}
}
#if 0
void print_array(int *array, int array_size)
{
int i = 0;
@ -51,7 +51,7 @@ void print_array(int *array, int array_size)
ALOGD("array[%d]=%d", i, array[i]);
}
}
#endif
static int * process_line(FILE *fp, int *ret_len)
{
char linebuf[MAX_LINE_SZ];
@ -101,7 +101,7 @@ static int * process_line(FILE *fp, int *ret_len)
int get_volume_config(struct volume_array *vol_array)
{
FILE *fp;
char *key_name;
char *key_name, *key_value;
char linebuf[MAX_LINE_SZ];
char *line;
int *val_array=NULL;
@ -284,10 +284,9 @@ int codec_voice_volume_init(struct volume_array *vol_array)
return 0;
}
void phone_volume_config(void *adev, int volume)
void phone_volume_config(struct sunxi_audio_device *adev, int volume)
{
(void)adev;
(void)volume;
}

View file

@ -49,5 +49,5 @@ LOCAL_C_INCLUDES +=system/core/include/ \
LOCAL_MODULE := hwcomposer.tulip
LOCAL_CFLAGS:= -DLOG_TAG=\"hwcomposer\"
LOCAL_MODULE_TAGS := optional
#TARGET_GLOBAL_CFLAGS += -DTARGET_BOARD_PLATFORM=$(TARGET_BOARD_PLATFORM)
TARGET_GLOBAL_CFLAGS += -DTARGET_BOARD_PLATFORM=$(TARGET_BOARD_PLATFORM)
include $(BUILD_SHARED_LIBRARY)

View file

@ -1,325 +0,0 @@
/*
* Copyright (C) 2010 ARM Limited. All rights reserved.
*
* Copyright (C) 2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef GRALLOC_PRIV_H_
#define GRALLOC_PRIV_H_
#include <stdint.h>
#include <pthread.h>
#include <errno.h>
#include <linux/fb.h>
#include <sys/types.h>
#include <unistd.h>
#include <hardware/gralloc.h>
#include <cutils/native_handle.h>
#include <utils/Log.h>
#ifdef MALI_600
#define GRALLOC_ARM_UMP_MODULE 0
#define GRALLOC_ARM_DMA_BUF_MODULE 1
#else
/* NOTE:
* If your framebuffer device driver is integrated with UMP, you will have to
* change this IOCTL definition to reflect your integration with the framebuffer
* device.
* Expected return value is a UMP secure id backing your framebuffer device memory.
*/
/*#define IOCTL_GET_FB_UMP_SECURE_ID _IOR('F', 311, unsigned int)*/
#define GRALLOC_ARM_UMP_MODULE 0
#define GRALLOC_ARM_DMA_BUF_MODULE 1
/* NOTE:
* If your framebuffer device driver is integrated with dma_buf, you will have to
* change this IOCTL definition to reflect your integration with the framebuffer
* device.
* Expected return value is a structure filled with a file descriptor
* backing your framebuffer device memory.
*/
#if GRALLOC_ARM_DMA_BUF_MODULE
struct fb_dmabuf_export
{
__u32 fd;
__u32 flags;
};
/*#define FBIOGET_DMABUF _IOR('F', 0x21, struct fb_dmabuf_export)*/
#endif /* GRALLOC_ARM_DMA_BUF_MODULE */
#endif
#define NUM_FB_BUFFERS 2
#if GRALLOC_ARM_UMP_MODULE
#include <ump/ump.h>
#endif
typedef enum
{
MALI_YUV_NO_INFO,
MALI_YUV_BT601_NARROW,
MALI_YUV_BT601_WIDE,
MALI_YUV_BT709_NARROW,
MALI_YUV_BT709_WIDE,
} mali_gralloc_yuv_info;
struct private_handle_t;
struct private_module_t
{
gralloc_module_t base;
private_handle_t* framebuffer;
uint32_t flags;
uint32_t numBuffers;
uint32_t bufferMask;
pthread_mutex_t lock;
buffer_handle_t currentBuffer;
int ion_client;
struct fb_var_screeninfo info;
struct fb_fix_screeninfo finfo;
float xdpi;
float ydpi;
float fps;
enum
{
// flag to indicate we'll post this buffer
PRIV_USAGE_LOCKED_FOR_POST = 0x80000000
};
/* default constructor */
private_module_t();
};
#ifdef __cplusplus
struct private_handle_t : public native_handle
{
#else
struct private_handle_t
{
struct native_handle nativeHandle;
#endif
enum
{
PRIV_FLAGS_FRAMEBUFFER = 0x00000001,
PRIV_FLAGS_USES_UMP = 0x00000002,
PRIV_FLAGS_USES_ION = 0x00000004,
PRIV_FLAGS_USES_CONFIG = 0x00000008,
};
enum
{
LOCK_STATE_WRITE = 1<<31,
LOCK_STATE_MAPPED = 1<<30,
LOCK_STATE_READ_MASK = 0x3FFFFFFF
};
// ints
#if GRALLOC_ARM_DMA_BUF_MODULE
/*shared file descriptor for dma_buf sharing*/
int share_fd;
#endif
int magic;
int flags;
int usage;
int size;
int width;
int height;
int format;
int stride;
int base;
int lockState;
int writeOwner;
int pid;
mali_gralloc_yuv_info yuv_info;
// Following members are for UMP memory only
#if GRALLOC_ARM_UMP_MODULE
int ump_id;
int ump_mem_handle;
#define GRALLOC_ARM_UMP_NUM_INTS 2
#else
#define GRALLOC_ARM_UMP_NUM_INTS 0
#endif
// Following members is for framebuffer only
int fd;
int offset;
#if GRALLOC_ARM_DMA_BUF_MODULE
struct ion_handle *ion_hnd;
#define GRALLOC_ARM_DMA_BUF_NUM_INTS 2
#else
#define GRALLOC_ARM_DMA_BUF_NUM_INTS 0
#endif
#if GRALLOC_ARM_DMA_BUF_MODULE
#define GRALLOC_ARM_NUM_FDS 1
#else
#define GRALLOC_ARM_NUM_FDS 0
#endif
#ifdef __cplusplus
/*
* We track the number of integers in the structure. There are 11 unconditional
* integers (magic - pid, yuv_info, fd and offset). The GRALLOC_ARM_XXX_NUM_INTS
* variables are used to track the number of integers that are conditionally
* included.
*/
static const int sNumInts = 15 + GRALLOC_ARM_UMP_NUM_INTS + GRALLOC_ARM_DMA_BUF_NUM_INTS;
static const int sNumFds = GRALLOC_ARM_NUM_FDS;
static const int sMagic = 0x3141592;
#if GRALLOC_ARM_UMP_MODULE
private_handle_t(int flags, int usage, int size, int base, int lock_state, ump_secure_id secure_id, ump_handle handle):
#if GRALLOC_ARM_DMA_BUF_MODULE
share_fd(-1),
#endif
magic(sMagic),
flags(flags),
usage(usage),
size(size),
width(0),
height(0),
format(0),
stride(0),
base(base),
lockState(lock_state),
writeOwner(0),
pid(getpid()),
yuv_info(MALI_YUV_NO_INFO),
ump_id((int)secure_id),
ump_mem_handle((int)handle),
fd(0),
offset(0)
#if GRALLOC_ARM_DMA_BUF_MODULE
,
ion_hnd(NULL)
#endif
{
version = sizeof(native_handle);
numFds = sNumFds;
numInts = sNumInts;
}
#endif
#if GRALLOC_ARM_DMA_BUF_MODULE
private_handle_t(int flags, int usage, int size, int base, int lock_state):
share_fd(-1),
magic(sMagic),
flags(flags),
usage(usage),
size(size),
width(0),
height(0),
format(0),
stride(0),
base(base),
lockState(lock_state),
writeOwner(0),
pid(getpid()),
yuv_info(MALI_YUV_NO_INFO),
#if GRALLOC_ARM_UMP_MODULE
ump_id((int)UMP_INVALID_SECURE_ID),
ump_mem_handle((int)UMP_INVALID_MEMORY_HANDLE),
#endif
fd(0),
offset(0),
ion_hnd(NULL)
{
version = sizeof(native_handle);
numFds = sNumFds;
numInts = sNumInts;
}
#endif
private_handle_t(int flags, int usage, int size, int base, int lock_state, int fb_file, int fb_offset):
#if GRALLOC_ARM_DMA_BUF_MODULE
share_fd(-1),
#endif
magic(sMagic),
flags(flags),
usage(usage),
size(size),
width(0),
height(0),
format(0),
stride(0),
base(base),
lockState(lock_state),
writeOwner(0),
pid(getpid()),
yuv_info(MALI_YUV_NO_INFO),
#if GRALLOC_ARM_UMP_MODULE
ump_id((int)UMP_INVALID_SECURE_ID),
ump_mem_handle((int)UMP_INVALID_MEMORY_HANDLE),
#endif
fd(fb_file),
offset(fb_offset)
#if GRALLOC_ARM_DMA_BUF_MODULE
,
ion_hnd(NULL)
#endif
{
version = sizeof(native_handle);
numFds = sNumFds;
numInts = sNumInts;
}
~private_handle_t()
{
magic = 0;
}
bool usesPhysicallyContiguousMemory()
{
return (flags & PRIV_FLAGS_FRAMEBUFFER) ? true : false;
}
static int validate(const native_handle* h)
{
const private_handle_t* hnd = (const private_handle_t*)h;
if (!h || h->version != sizeof(native_handle) || h->numInts != sNumInts || h->numFds != sNumFds || hnd->magic != sMagic)
{
return -EINVAL;
}
return 0;
}
static private_handle_t* dynamicCast(const native_handle* in)
{
if (validate(in) == 0)
{
return (private_handle_t*) in;
}
return NULL;
}
#endif
};
#endif /* GRALLOC_PRIV_H_ */

View file

@ -19,26 +19,27 @@
#include "cutils/properties.h"
static int Framecount = 0;
/*****************************************************************************/
static int hwc_device_open(const struct hw_module_t* module, const char* name,
struct hw_device_t** device);
static struct hw_module_methods_t hwc_module_methods = {
.open = hwc_device_open
open: hwc_device_open
};
hwc_module_t HAL_MODULE_INFO_SYM = {
.common = {
.tag = HARDWARE_MODULE_TAG,
.version_major = 1,
.version_minor = 0,
.id = HWC_HARDWARE_MODULE_ID,
.name = "Sunxi hwcomposer module",
.author = "Allwinner Tech",
.methods = &hwc_module_methods,
.dso = 0,
.reserved = {0},
common: {
tag: HARDWARE_MODULE_TAG,
version_major: 1,
version_minor: 0,
id: HWC_HARDWARE_MODULE_ID,
name: "Sunxi hwcomposer module",
author: "Allwinner Tech",
methods: &hwc_module_methods,
dso: 0,
reserved: {0},
}
};
@ -46,7 +47,6 @@ hwc_module_t HAL_MODULE_INFO_SYM = {
int hwc_get_density(int width, int height)
{
(void)width;
char name[100];
char value[PROPERTY_VALUE_MAX];
sprintf(name, "ro.sf.lcd_density.%d", height);
@ -77,7 +77,7 @@ static int hwc_blank(struct hwc_composer_device_1* dev, int disp, int blank)
}
return 0;
}
/*
static int hwc_setParameter(struct hwc_composer_device_1* dev, int cmd, int disp,
int para0, int para1)
{
@ -125,7 +125,7 @@ static int hwc_getParameter(struct hwc_composer_device_1* dev, int cmd, int disp
HWC_UNREFERENCED_PARAMETER(para1);
return 0;
}
*/
static
@ -312,8 +312,8 @@ static int hwc_device_open(const struct hw_module_t* module, const char* name,
psHwcDevice->prepare = hwc_prepare;
psHwcDevice->set = hwc_set;
//psHwcDevice->setParameter = hwc_setParameter;
//psHwcDevice->getParameter = hwc_getParameter;
psHwcDevice->setParameter = hwc_setParameter;
psHwcDevice->getParameter = hwc_getParameter;
psHwcDevice->registerProcs = hwc_register_procs;
psHwcDevice->eventControl = hwc_eventControl;
psHwcDevice->blank = hwc_blank;

View file

@ -4,11 +4,11 @@
#include <hardware/hardware.h>
#include <hardware/hwcomposer.h>
//#include <hal_public.h>
#include <hardware/hal_public.h>
#include "sunxi_display2.h"
#include "sunxi_tr.h"
#include "gralloc_priv.h"
#include <linux/fb.h>
//#include "gralloc_priv.h"
//#include "fb.h"
#include <fcntl.h>
#include <errno.h>
@ -310,26 +310,6 @@ typedef struct ChannelInfo{
layer_info_t *HwLayer[NUMLAYEROFCHANNEL];
} ChannelInfo_t;
/* cmd parameter for setParameter() */
typedef enum{
DISPLAY_CMD_SET3DMODE = 0x01,
DISPLAY_CMD_SETBACKLIGHTMODE = 0x02,
DISPLAY_CMD_SETBACKLIGHTDEMOMODE = 0x03,
DISPLAY_CMD_SETDISPLAYENHANCEMODE = 0x04,
DISPLAY_CMD_SETDISPLAYENHANCEDEMOMODE = 0x05,
DISPLAY_CMD_SETOUTPUTMODE = 0x06,
DISPLAY_CMD_HDMIPERSENT = 0x07
}__display_cmd_t;
typedef enum
{
DISPLAY_2D_ORIGINAL = 0,
DISPLAY_2D_LEFT = 1,
DISPLAY_2D_TOP = 2,
DISPLAY_3D_LEFT_RIGHT_HDMI = 3,
DISPLAY_3D_TOP_BOTTOM_HDMI = 4,
}__display_3d_mode;
typedef struct{
int VirtualToHWDisplay;
bool VsyncEnable;

View file

@ -66,6 +66,7 @@ void hwc_head_commit(hwc_dispc_data_t *head, hwc_commit_data_t *commit_data)
hwc_dispc_data_t* hwc_layer_cache_get(SUNXI_hwcdev_context_t *Globctx, int countdisp)
{
int i = 0, cout_cut = 2;
bool fix = 0;
list_head_t *head_pos = NULL;
list_head_t *head_bak = NULL;
hwc_dispc_data_t *manage_cache = NULL;
@ -206,10 +207,11 @@ void hwc_manage_layer_cache(SUNXI_hwcdev_context_t *Globctx, hwc_dispc_data_t *c
{
list_head_t *reference_commit = NULL;
list_head_t *head_pos = NULL;
list_head_t *head_bak = NULL;
hwc_dispc_data_t *manage_cache = NULL;
hwc_dispc_data_t *reference_cache = NULL;
long offset = 0;
int i = 0;
int i = 0, j = 0;
offset = container_of(hwc_dispc_data_t, manage_head);
if(commit_head != NULL)
@ -332,12 +334,13 @@ void *commit_thread(void *priv)
list_head_t *CommitList = NULL;
hwc_dispc_data_t *DisplayData = NULL;
int i = 0, j = 0, ret = -1, lyr = 0, rotatecall = 0;
int primary_disp = 0, tr_fence_fd = -1, share_fd = -1, has_tr = 0;
int primary_disp = 0, tr_fence_fd = -1, share_fd = -1, release_rotate = 0, has_tr = 0;
unsigned long arg[4] = {0};
unsigned int current_sync_count = 0, cusor_sync = 0;
hwc_ioctl_arg hwc_cmd;
hwc_cmd.cmd = HWC_IOCTL_COMMIT;
hwc_commit_data_t commit_data;
disp_capture_info wb_data;
hwc_commit_layer_t cursor_layer[NUMBEROFDISPLAY];
bool need_sync = 0, pause = 0;
int continues_stop = 0;
@ -350,6 +353,7 @@ void *commit_thread(void *priv)
double starttime = 0.0;
gettimeofday(&tv, NULL);
starttime = tv.tv_sec * 1000 + tv.tv_usec / 1.0e3;
double fCurrentTime = 0.0;
//fiix
memset(cursor_layer, 0, sizeof(hwc_commit_layer_t) * NUMBEROFDISPLAY);
setpriority(PRIO_PROCESS, 0, HAL_PRIORITY_URGENT_DISPLAY);

View file

@ -297,6 +297,7 @@ void hwc_cursor_manage(SUNXI_hwcdev_context_t *Globctx,
int i = 0, disp = -1;
DisplayInfo *cursor_disp = NULL;
hwc_cursor_async_t *set_cursor = NULL;
bool has_cursor = 0;
for(i = 0; i < Globctx->NumberofDisp; i++)
{

View file

@ -105,7 +105,7 @@ void show_displays(HwcDisContext_t *Localctx)
,Localctx->ChannelInfo[1].memthruput
,Localctx->ChannelInfo[2].memthruput
,Localctx->ChannelInfo[3].memthruput
,(long long)PsDisplayInfo->mytimestamp);
,PsDisplayInfo->mytimestamp);
ALOGD("+---------+--+---+---+-----+--+---+--------------+--------+--------+--------+--------+--------+--------+--------+--------+--------+----------+");
ALOGD("+\n"
@ -132,9 +132,9 @@ void show_displays(HwcDisContext_t *Localctx)
sunxiLayers->virchannel >= 0 ?
Localctx->ChannelInfo[sunxiLayers->virchannel].planeAlpha : 0xff,
sunxiLayers->need_sync,
(unsigned int)((unsigned long)l->handle),
l->handle,
handle == 0 ? 0 :
((handle->flags & private_handle_t::PRIV_FLAGS_USES_ION) ? ion_get_addr_fromfd(handle->share_fd):0),
((handle->flags & private_handle_t::PRIV_FLAGS_USES_CONFIG) ? ion_get_addr_fromfd(handle->share_fd):0),
handle == 0 ? 0 : handle->usage,
l->flags,
l->transform,
@ -270,6 +270,7 @@ void hwc_debug_close_layer(SUNXI_hwcdev_context_t *psCtx, hwc_commit_data_t *com
if(psCtx->hwcdebug && psCtx->close_layer)
{
disp_layer_config *fix_layer = NULL;
hwc_commit_layer_t *hwc_layer_info = NULL;
int lyr = -1;
char property[PROPERTY_VALUE_MAX];
char *ps_fix = property;
@ -444,7 +445,7 @@ void hwc_debug_dump_layer(SUNXI_hwcdev_context_t *psCtx,
ret = ::write(fd, addr_0, size);
if(ret != size)
{
ALOGD("write %d err %s", ret, dump_src);
ALOGD("write %s err %d", ret, dump_src);
}
munmap(addr_0,size);
close(fd);
@ -463,6 +464,7 @@ bool hwc_debug_pause(SUNXI_hwcdev_context_t *psCtx, int sync_count, bool paused)
char *ps_fix = property;
if (property_get("debug.hwc.showfps", property, NULL) >= 0)
{
bool change = 0;
if(!hwc_cmp("set", ps_fix))
{
ALOGD("###Pause at frame:%d ###", sync_count-1);

View file

@ -188,7 +188,7 @@ void ion_free_cache(hwc_ion_hold_t *ion_cache)
bool hwc_manage_ref_cache(bool cache, hwc_dispc_data_t *dispc_data)
{
hwc_ion_hold_t *ion_cache = NULL;
int i, cnt = 0, size = 0;
int i, little_sync, cnt = 0, size = 0;
hwc_commit_layer_t *commit_layer = NULL;
int *_array = NULL;

View file

@ -21,12 +21,14 @@ AssignDUETO_T calculate_memthruput(HwcDisContext_t *Localctx, layer_info_t *hwLa
int memoflayer = 0, whilecnt = 0, fb_mem = 0, need_mem = 0;
SUNXI_hwcdev_context_t *Globctx = &gSunxiHwcDevice;
hwc_layer_1_t *psLayer = hwLayer->psLayer;
struct private_handle_t *handle = (struct private_handle_t*)psLayer->handle;
ChannelInfo_t *channelinfo;
hwc_rect_t rectx = {0,0,0,0};
hwc_rect_t rectx2 = {0,0,0,0};
hwc_rect_t *psdiplay = &psLayer->displayFrame;
int prememvideo;
prememvideo = Localctx->prememvideo;
bool re_cal_mem = 1;
channelinfo = &Localctx->ChannelInfo[channel];
if(check_swap_w_h(psLayer->transform))
@ -108,6 +110,7 @@ AssignDUETO_T calculate_memthruput(HwcDisContext_t *Localctx, layer_info_t *hwLa
fb_mem = Localctx->cur_fb_thruput;
}
cal_mem:
need_mem = Globctx->currentmem + memoflayer + prememvideo + fb_mem
+ Globctx->fb_pre_mem - Globctx->memlimit;
if(need_mem <= 0)
@ -127,6 +130,7 @@ AssignDUETO_T calculate_memthruput(HwcDisContext_t *Localctx, layer_info_t *hwLa
}else{
goto overflow;
}
fix_mem:
Localctx->cur_de_thruput += memoflayer;
channelinfo->memthruput += memoflayer;
Globctx->currentmem += memoflayer;
@ -248,7 +252,9 @@ void hwc_updata_limit(SUNXI_hwcdev_context_t *Globctx,
static double fps_time[3];//0 for 20st time, 1 for 40st time, 2 for 60st time
diff_sync_count = DisplayData->sync_count - start_count;
i = 0;
static int de_mem_all = 0;
static int mem_all_diff = 0, setup_cnt = 0, de_mem_all = 0;
int lower_max_mem = 0, mem_setup = 0;
bool dvfs_start = 0;
while(i < NUMBEROFDISPLAY)
{
local_mem[i] = DisplayData->local_mem[i];
@ -345,6 +351,7 @@ bool mem_ctrl_power_policy(SUNXI_hwcdev_context_t *Globctx, HwcDisContext_t *loc
goto gpu_composite;
}
}
de_composite:
return 0;
gpu_composite:

View file

@ -21,6 +21,7 @@ static int _hwc_device_set_3d_mode_per_display(int disp, __display_3d_mode new_m
DisplayInfo *PsDisplayInfo = &Globctx->SunxiDisplay[disp];
__display_3d_mode old_mode = PsDisplayInfo->Current3DMode;
static int last2dMode;
unsigned long arg[4]={0};
disp_tv_mode current_mode;
if(old_mode == new_mode)
{

View file

@ -179,7 +179,6 @@ static hwc_cache_t *hwc_tr_cache_get(rotate_cache_t *rotate_cache, int size, int
tr_cache->share_fd = -1;
tr_cache->size_buffer = 0;
}
#define ION_HEAP_SECURE_MASK 1
if(tr_cache->share_fd == -1 || tr_cache->size_buffer == 0)
{
if(is_secure){
@ -222,7 +221,7 @@ static hwc_cache_t *hwc_tr_cache_get(rotate_cache_t *rotate_cache, int size, int
static hwc_cache_t *hwc_cache_get_last(rotate_cache_t *rotate_cache, unsigned int sync_count)
{
hwc_cache_t *tr_cache = NULL;
int i = 0, biggest = -1;
int i = 0, biggest = -1, ret = -1;
unsigned int big_sync = 0;
for(i = 0; i < ROTATE_CACHE_COUNT; i++)
@ -252,7 +251,7 @@ void hwc_rotate_cache_free(void)
SUNXI_hwcdev_context_t *Globctx = &gSunxiHwcDevice;
hwc_cache_t *tr_cache = NULL;
rotate_cache_t *rotate_cache = NULL;
int i = 0;
int i = 0, j = 0;
list_head_t *head = NULL;
ALOGD("hwc_rotate_cache_free[%d]",Globctx->rotate_hold_cnt);
while(NULL != (head = hwc_list_get(&Globctx->rotate_cache_list)))
@ -502,17 +501,23 @@ void hwc_resize_crop(disp_fb_info *hw_layer, int w_original, int h_original, tr_
{
case TR_HFLIP:
w_diff = hw_layer->size[0].width - w_original;
hw_layer->crop.x + (long long)(((long long)w_diff)<<32);
break;
case TR_VFLIP:
h_diff = hw_layer->size[0].height - h_original;
hw_layer->crop.y + (long long)(((long long)h_diff)<<32);
break;
case TR_ROT_90:
w_diff = hw_layer->size[0].width - h_original;
hw_layer->crop.x + (long long)(((long long)w_diff)<<32);
h_diff = hw_layer->size[0].height - w_original;
hw_layer->crop.y + (long long)(((long long)h_diff)<<32);
break;
case TR_ROT_180:
h_diff = hw_layer->size[0].height - h_original;
hw_layer->crop.y + (long long)(((long long)h_diff)<<32);
w_diff = hw_layer->size[0].width - w_original;
hw_layer->crop.x + (long long)(((long long)w_diff)<<32);
break;
case TR_ROT_270:
break;
@ -540,9 +545,11 @@ bool hwc_need_check_format(unsigned char fmt)
bool hwc_tr_to_layer(disp_fb_info *hw_layer, tr_info *tr_info, hwc_cache_t *tr_buffer, bool last)
{
int i = 0;
unsigned int swap_w_h = 0;
unsigned long addr = 0;
unsigned int w_stride, h_stride;
int w_original, h_original;
int w_change, h_change, w_original, h_original;
if(hwc_need_check_format(tr_info->dst_frame.fmt))
{
@ -604,6 +611,7 @@ void hwc_rotate_finish(int cnt_st)
{
SUNXI_hwcdev_context_t *Globctx = &gSunxiHwcDevice;
list_head_t *head = NULL;
int j = 0;
if(cnt_st < Globctx->rotate_hold_cnt)
{
head = Globctx->rotate_cache_list.prev;
@ -618,7 +626,7 @@ bool hwc_rotate_layer_tr(hwc_dispc_data_t *hwc_layer,
disp_layer_config *disp_layer = NULL;
hwc_commit_layer_t *commit_layer = NULL;
int lyr = 0, size = 0, i = 0, ret = -1;
int lyr = 0, size = 0, i = 0, ret = -1, width = 0, height = 0;
hwc_cache_t *tr_cache = NULL;
tr_info tr_info;
bool last = 0;
@ -715,6 +723,7 @@ tr2layer:
}else{
goto translat_err;
}
translat_ok:
close(commit_layer->share_fd);
commit_layer->share_fd = dup(tr_cache->share_fd);
commit_layer->tr = 0;

View file

@ -30,7 +30,9 @@ static mem_speed_limit_t mem_speed_limit[3] =
static void reset_layer_type(HwcDisContext_t *Localctx, int hwctype)
{
SUNXI_hwcdev_context_t *Globctx = &gSunxiHwcDevice;
int j = 0;
struct private_handle_t *handle = NULL;
layer_info_t *psAllLayer = Localctx->psAllLayer;
hwc_layer_1_t *psLayer = NULL;
for(j = 0; j < Localctx->numberofLayer; j++)
@ -245,7 +247,7 @@ static bool reset_globle(SUNXI_hwcdev_context_t *Globctx,
}
if(handle != NULL
&& psLayer->transform != 0
&& (handle->flags & private_handle_t::PRIV_FLAGS_USES_ION))
&& (handle->flags & private_handle_t::PRIV_FLAGS_USES_CONFIG))
{
has_tr = 1;
}
@ -372,6 +374,7 @@ static bool check_fix_rotate(SUNXI_hwcdev_context_t *Globctx, hwc_layer_1_t *lay
goto tr_faild;
}
tr_ok:
return 1;
tr_faild:
@ -744,6 +747,7 @@ static bool resize_layer(HwcDisContext_t *Localctx,
int handle_w, handle_h;
hwc_layer_1_t *psLayer = hwc_layer->psLayer;
float WScaleFactor = 1.0, HScaleFactor = 1.0;
struct private_handle_t *handle = (struct private_handle_t*)psLayer->handle;
bool cut_left = 0, cut_right = 0, cut_top = 0, cut_bottom = 0;
const DisplayInfo *PsDisplayInfo = Localctx->psDisplayInfo;
rect64 Layer_crop[4];
@ -1067,7 +1071,7 @@ HwcAssignStatus hwc_try_assign_layer(HwcDisContext_t *Localctx, size_t singcout,
addLayerCnt = 2;
}
if(!(handle->flags & private_handle_t::PRIV_FLAGS_USES_ION))
if(!(handle->flags & private_handle_t::PRIV_FLAGS_USES_CONFIG))
{
ALOGV("%s:not continuous Memory", __func__);
Localctx->UsedFB = 1;
@ -1269,6 +1273,7 @@ needchannel:
{
dueto = D_MEM_CTRL;
}
assign_overlay:
has_tr = (!is_cursor && psLayer->transform != 0);
Localctx->unasignedVideo -= isvideo;
@ -1346,6 +1351,7 @@ int hwc_setup_layer(hwc_dispc_data_t *DisplayData, HwcDisContext_t *Localctx)
hwc_commit_layer_t *hw_layer_config = NULL;
const DisplayInfo *PsDisplayInfo = Localctx->psDisplayInfo;
ChannelInfo_t *psChannelInfo = Localctx->ChannelInfo;
struct private_handle_t *handle = NULL;
ture_disp = PsDisplayInfo->VirtualToHWDisplay;
if(ture_disp < 0 || ture_disp >= NUMBEROFDISPLAY)
@ -1569,7 +1575,7 @@ ReAssignedLayer:
break;
case ASSIGN_FAILED:
ALOGD("Use GPU composite FB failed [%d]", (int)disp);
ALOGD("Use GPU composite FB failed [%d]", disp);
reset_local(Localctx);
break;
case ASSIGN_NEEDREASSIGNED:
@ -1602,7 +1608,7 @@ bool sunxi_set(hwc_display_contents_1_t **displays, size_t numDisplays)
hwc_display_contents_1_t *psDisplay = NULL;
hwc_layer_1_t *fb_layer = NULL;
int ret = -1, mergfd = -1, ture_disp = -EINVAL;
size_t disp, i;
size_t disp, i, j;
unsigned long arg[4] = {0};
/* 0 for hardware DISP0,1 for DISP1,2 for WB,3 for FB Cache;*/
int returnfenceFd[CNOUTDISPSYNC] =
@ -1635,7 +1641,7 @@ bool sunxi_set(hwc_display_contents_1_t **displays, size_t numDisplays)
#endif
)
{
ALOGV("display[%d] has no display content...", (int)disp);
ALOGV("display[%d] has no display content...", disp);
continue;
}
fb_layer = &psDisplay->hwLayers[psDisplay->numHwLayers-1];
@ -1712,7 +1718,7 @@ deal_fence:
ture_disp = PsDisplayInfo->VirtualToHWDisplay;
if(!psDisplay)
{
ALOGV("%s: display[%d] was unexpectedly NULL", __func__, (int)disp);
ALOGV("%s: display[%d] was unexpectedly NULL", __func__, disp);
continue;
}
if(ture_disp < NUMBEROFDISPLAY
@ -1783,7 +1789,7 @@ static int hwc_init_display(void)
{
SUNXI_hwcdev_context_t *Globctx = &gSunxiHwcDevice;
int refreshRate;
int refreshRate, xdpi, ydpi, vsync_period;
bool needupdate;
struct fb_var_screeninfo info;
int arg[4] = {0};
@ -1937,8 +1943,11 @@ SUNXI_hwcdev_context_t* hwc_create_device(void)
{
SUNXI_hwcdev_context_t *Globctx = &gSunxiHwcDevice;
char property[PROPERTY_VALUE_MAX];
unsigned long arg[4] = {0};
int outtype;
int open_fd;
int DispCnt, j;
disp_tv_mode hdmi_mode;
Globctx->DisplayFd = open("/dev/disp", O_RDWR);
if (Globctx->DisplayFd < 0)

View file

@ -320,8 +320,9 @@ static int hwc_uevent(void)
const int buffersize = 32*1024;
char *buf = NULL;
struct pollfd fds;
bool stop_hwc = 0;
int count, IsVsync, IsHdmi, hotplug_sock, retval, display_id = -1;
unsigned int new_hdmi_hpd = 0;
unsigned int cout = 0, new_hdmi_hpd = 0;
uint64_t timestamp = 0;
const char *s = NULL;
SUNXI_hwcdev_context_t *Globctx = &gSunxiHwcDevice;
@ -361,6 +362,7 @@ static int hwc_uevent(void)
double starttime = 0.0;
gettimeofday(&tv, NULL);
starttime = tv.tv_sec * 1000 + tv.tv_usec / 1.0e3;
double fCurrentTime = 0.0;
ALOGD("######hwc uevent Thread(%d)%p.#######", gettid(), &snl);
while(1)

View file

@ -34,6 +34,7 @@ void hwc_wb_manage(hwc_dispc_data_t *DisplayData, hwc_commit_data_t *commit_data
HWC_UNREFERENCED_PARAMETER(commit_data);
HWC_UNREFERENCED_PARAMETER(DisplayData);
HWC_UNREFERENCED_PARAMETER(data);
hwc_cache_t* hwc_cache = NULL;
}

View file

@ -49,8 +49,9 @@ static int rgb_to_brightness(struct light_state_t const *state)
static int set_light_backlight(struct light_device_t *dev,
struct light_state_t const *state)
{
(void)dev;
struct light_context_t *ctx;
int brightness = rgb_to_brightness(state);
int i = 0;
unsigned long args[3];
int err = 0;
pthread_mutex_lock(&g_lock);
@ -80,6 +81,7 @@ static int close_lights(struct light_device_t *dev)
static int open_lights(const struct hw_module_t *module, char const *name,
struct hw_device_t **device)
{
pthread_t lighting_poll_thread;
int (*set_light) (struct light_device_t *dev,
struct light_state_t const *state);