android 9 fixes
This commit is contained in:
parent
1f6222aefc
commit
d2fb5adc58
28 changed files with 287 additions and 240 deletions
|
@ -521,6 +521,7 @@ static int do_output_standby(struct sunxi_stream_out *out);
|
||||||
|
|
||||||
/* The enable flag when 0 makes the assumption that enums are disabled by
|
/* The enable flag when 0 makes the assumption that enums are disabled by
|
||||||
* "Off" and integers/booleans by 0 */
|
* "Off" and integers/booleans by 0 */
|
||||||
|
#if 0
|
||||||
static int set_route_by_array(struct mixer *mixer, struct route_setting *route,
|
static int set_route_by_array(struct mixer *mixer, struct route_setting *route,
|
||||||
int enable)
|
int enable)
|
||||||
{
|
{
|
||||||
|
@ -553,6 +554,7 @@ static int set_route_by_array(struct mixer *mixer, struct route_setting *route,
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static int bt_start_call(struct sunxi_audio_device *adev)
|
static int bt_start_call(struct sunxi_audio_device *adev)
|
||||||
{
|
{
|
||||||
|
@ -889,6 +891,7 @@ static void select_mode(struct sunxi_audio_device *adev)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
static int i2s_suspend_get()
|
static int i2s_suspend_get()
|
||||||
{
|
{
|
||||||
int ret = -1, fd = 0;
|
int ret = -1, fd = 0;
|
||||||
|
@ -966,10 +969,9 @@ static int check_hdmi_status()
|
||||||
}
|
}
|
||||||
return switch_to_hdmi;
|
return switch_to_hdmi;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
static void select_device(struct sunxi_audio_device *adev)
|
static void select_device(struct sunxi_audio_device *adev)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
|
||||||
int output_device_id = 0;
|
int output_device_id = 0;
|
||||||
int input_device_id = 0;
|
int input_device_id = 0;
|
||||||
const char *output_route = NULL;
|
const char *output_route = NULL;
|
||||||
|
@ -1336,7 +1338,6 @@ 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)
|
static size_t get_input_buffer_size(uint32_t sample_rate, int format, int channel_count)
|
||||||
{
|
{
|
||||||
size_t size;
|
size_t size;
|
||||||
size_t device_rate;
|
|
||||||
|
|
||||||
if (check_input_parameters(sample_rate, format, channel_count) != 0)
|
if (check_input_parameters(sample_rate, format, channel_count) != 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1387,6 +1388,7 @@ static struct echo_reference_itfe *get_echo_reference(struct sunxi_audio_device
|
||||||
uint32_t channel_count,
|
uint32_t channel_count,
|
||||||
uint32_t sampling_rate)
|
uint32_t sampling_rate)
|
||||||
{
|
{
|
||||||
|
(void)format;
|
||||||
put_echo_reference(adev, adev->echo_reference);
|
put_echo_reference(adev, adev->echo_reference);
|
||||||
if (adev->active_output != NULL) {
|
if (adev->active_output != NULL) {
|
||||||
struct audio_stream *stream = &adev->active_output->stream.common;
|
struct audio_stream *stream = &adev->active_output->stream.common;
|
||||||
|
@ -1413,7 +1415,7 @@ static int get_playback_delay(struct sunxi_stream_out *out,
|
||||||
size_t kernel_frames;
|
size_t kernel_frames;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
status = pcm_get_htimestamp(out->pcm, &kernel_frames, &buffer->time_stamp);
|
status = pcm_get_htimestamp(out->pcm, (unsigned int*)&kernel_frames, &buffer->time_stamp);
|
||||||
if (status < 0) {
|
if (status < 0) {
|
||||||
buffer->time_stamp.tv_sec = 0;
|
buffer->time_stamp.tv_sec = 0;
|
||||||
buffer->time_stamp.tv_nsec = 0;
|
buffer->time_stamp.tv_nsec = 0;
|
||||||
|
@ -1442,7 +1444,6 @@ static int out_get_presentation_position(const struct audio_stream_out *stream,
|
||||||
|
|
||||||
pthread_mutex_lock(&out->lock);
|
pthread_mutex_lock(&out->lock);
|
||||||
|
|
||||||
int i;
|
|
||||||
// There is a question how to implement this correctly when there is more than one PCM stream.
|
// 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,
|
// 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
|
// not the total played since start. The current behavior should be safe because the
|
||||||
|
@ -1450,7 +1451,7 @@ static int out_get_presentation_position(const struct audio_stream_out *stream,
|
||||||
//for (i = 0; i < PCM_TOTAL; i++)
|
//for (i = 0; i < PCM_TOTAL; i++)
|
||||||
if (out->pcm) {
|
if (out->pcm) {
|
||||||
size_t avail;
|
size_t avail;
|
||||||
if (pcm_get_htimestamp(out->pcm, &avail, timestamp) == 0) {
|
if (pcm_get_htimestamp(out->pcm, (unsigned int *)&avail, timestamp) == 0) {
|
||||||
size_t kernel_buffer_size = out->config.period_size * out->config.period_count;
|
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
|
// FIXME This calculation is incorrect if there is buffering after app processor
|
||||||
int64_t signed_frames = out->written - kernel_buffer_size + avail;
|
int64_t signed_frames = out->written - kernel_buffer_size + avail;
|
||||||
|
@ -1469,11 +1470,14 @@ static int out_get_presentation_position(const struct audio_stream_out *stream,
|
||||||
|
|
||||||
static uint32_t out_get_sample_rate(const struct audio_stream *stream)
|
static uint32_t out_get_sample_rate(const struct audio_stream *stream)
|
||||||
{
|
{
|
||||||
|
(void)stream;
|
||||||
return DEFAULT_OUT_SAMPLING_RATE;
|
return DEFAULT_OUT_SAMPLING_RATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int out_set_sample_rate(struct audio_stream *stream, uint32_t rate)
|
static int out_set_sample_rate(struct audio_stream *stream, uint32_t rate)
|
||||||
{
|
{
|
||||||
|
(void)stream;
|
||||||
|
(void)rate;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1486,21 +1490,25 @@ static size_t out_get_buffer_size(const struct audio_stream *stream)
|
||||||
be a multiple of 16 frames */
|
be a multiple of 16 frames */
|
||||||
size_t size = (SHORT_PERIOD_SIZE * DEFAULT_OUT_SAMPLING_RATE) / out->config.rate;
|
size_t size = (SHORT_PERIOD_SIZE * DEFAULT_OUT_SAMPLING_RATE) / out->config.rate;
|
||||||
size = ((size + 15) / 16) * 16;
|
size = ((size + 15) / 16) * 16;
|
||||||
return size * audio_stream_frame_size((struct audio_stream *)stream);
|
return size * audio_stream_out_frame_size((struct audio_stream_out *)stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
static audio_channel_mask_t out_get_channels(const struct audio_stream *stream)
|
static audio_channel_mask_t out_get_channels(const struct audio_stream *stream)
|
||||||
{
|
{
|
||||||
|
(void)stream;
|
||||||
return AUDIO_CHANNEL_OUT_STEREO;
|
return AUDIO_CHANNEL_OUT_STEREO;
|
||||||
}
|
}
|
||||||
|
|
||||||
static audio_format_t out_get_format(const struct audio_stream *stream)
|
static audio_format_t out_get_format(const struct audio_stream *stream)
|
||||||
{
|
{
|
||||||
|
(void)stream;
|
||||||
return AUDIO_FORMAT_PCM_16_BIT;
|
return AUDIO_FORMAT_PCM_16_BIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int out_set_format(struct audio_stream *stream, audio_format_t format)
|
static int out_set_format(struct audio_stream *stream, audio_format_t format)
|
||||||
{
|
{
|
||||||
|
(void)stream;
|
||||||
|
(void)format;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1543,6 +1551,8 @@ static int out_standby(struct audio_stream *stream)
|
||||||
|
|
||||||
static int out_dump(const struct audio_stream *stream, int fd)
|
static int out_dump(const struct audio_stream *stream, int fd)
|
||||||
{
|
{
|
||||||
|
(void)stream;
|
||||||
|
(void)fd;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1552,7 +1562,6 @@ static int out_set_parameters(struct audio_stream *stream, const char *kvpairs)
|
||||||
struct sunxi_audio_device *adev = out->dev;
|
struct sunxi_audio_device *adev = out->dev;
|
||||||
struct sunxi_stream_in *in;
|
struct sunxi_stream_in *in;
|
||||||
struct str_parms *parms;
|
struct str_parms *parms;
|
||||||
char *str;
|
|
||||||
char value[32];
|
char value[32];
|
||||||
int ret, val = 0;
|
int ret, val = 0;
|
||||||
bool force_input_standby = false;
|
bool force_input_standby = false;
|
||||||
|
@ -1604,7 +1613,7 @@ static int out_set_parameters(struct audio_stream *stream, const char *kvpairs)
|
||||||
pthread_mutex_unlock(&adev->lock);
|
pthread_mutex_unlock(&adev->lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = str_parms_get_str(parms, AUDIO_PARAMETER_RAW_DATA_OUT, value, sizeof(value));
|
ret = str_parms_get_str(parms, "raw_data_output", value, sizeof(value));
|
||||||
if (ret >= 0) {
|
if (ret >= 0) {
|
||||||
bool bval = (atoi(value) == 1) ? true : false;
|
bool bval = (atoi(value) == 1) ? true : false;
|
||||||
ALOGV("AUDIO_PARAMETER_RAW_DATA_OUT: %d", bval);
|
ALOGV("AUDIO_PARAMETER_RAW_DATA_OUT: %d", bval);
|
||||||
|
@ -1624,6 +1633,8 @@ 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)
|
static char * out_get_parameters(const struct audio_stream *stream, const char *keys)
|
||||||
{
|
{
|
||||||
|
(void)stream;
|
||||||
|
(void)keys;
|
||||||
return strdup("");
|
return strdup("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1637,6 +1648,9 @@ static uint32_t out_get_latency(const struct audio_stream_out *stream)
|
||||||
static int out_set_volume(struct audio_stream_out *stream, float left,
|
static int out_set_volume(struct audio_stream_out *stream, float left,
|
||||||
float right)
|
float right)
|
||||||
{
|
{
|
||||||
|
(void)stream;
|
||||||
|
(void)left;
|
||||||
|
(void)right;
|
||||||
return -ENOSYS;
|
return -ENOSYS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1646,12 +1660,11 @@ static ssize_t out_write(struct audio_stream_out *stream, const void* buffer,
|
||||||
int ret;
|
int ret;
|
||||||
struct sunxi_stream_out *out = (struct sunxi_stream_out *)stream;
|
struct sunxi_stream_out *out = (struct sunxi_stream_out *)stream;
|
||||||
struct sunxi_audio_device *adev = out->dev;
|
struct sunxi_audio_device *adev = out->dev;
|
||||||
size_t frame_size = audio_stream_frame_size(&out->stream.common);
|
size_t frame_size = audio_stream_out_frame_size((struct audio_stream_out*)&out->stream.common);
|
||||||
size_t in_frames = bytes / frame_size;
|
size_t in_frames = bytes / frame_size;
|
||||||
size_t out_frames = RESAMPLER_BUFFER_SIZE / frame_size;
|
size_t out_frames = RESAMPLER_BUFFER_SIZE / frame_size;
|
||||||
bool force_input_standby = false;
|
bool force_input_standby = false;
|
||||||
struct sunxi_stream_in *in;
|
struct sunxi_stream_in *in;
|
||||||
int kernel_frames;
|
|
||||||
void *buf;
|
void *buf;
|
||||||
|
|
||||||
if (adev->mode == AUDIO_MODE_IN_CALL || adev->mode == AUDIO_MODE_MODE_FACTORY_TEST || adev->mode == AUDIO_MODE_FM) {
|
if (adev->mode == AUDIO_MODE_IN_CALL || adev->mode == AUDIO_MODE_MODE_FACTORY_TEST || adev->mode == AUDIO_MODE_FM) {
|
||||||
|
@ -1666,7 +1679,7 @@ static ssize_t out_write(struct audio_stream_out *stream, const void* buffer,
|
||||||
return 0;
|
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_dl);
|
||||||
pcm_stop(adev->pcm_modem_ul);
|
pcm_stop(adev->pcm_modem_ul);
|
||||||
pcm_close(adev->pcm_modem_dl);
|
pcm_close(adev->pcm_modem_dl);
|
||||||
|
@ -1751,7 +1764,7 @@ exit:
|
||||||
pthread_mutex_unlock(&out->lock);
|
pthread_mutex_unlock(&out->lock);
|
||||||
|
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
usleep(bytes * 1000000 / audio_stream_frame_size(&stream->common) /
|
usleep(bytes * 1000000 / audio_stream_out_frame_size((struct audio_stream_out*)&stream->common) /
|
||||||
out_get_sample_rate(&stream->common));
|
out_get_sample_rate(&stream->common));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1772,22 +1785,30 @@ exit:
|
||||||
static int out_get_render_position(const struct audio_stream_out *stream,
|
static int out_get_render_position(const struct audio_stream_out *stream,
|
||||||
uint32_t *dsp_frames)
|
uint32_t *dsp_frames)
|
||||||
{
|
{
|
||||||
|
(void)stream;
|
||||||
|
(void)dsp_frames;
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int out_add_audio_effect(const struct audio_stream *stream, effect_handle_t effect)
|
static int out_add_audio_effect(const struct audio_stream *stream, effect_handle_t effect)
|
||||||
{
|
{
|
||||||
|
(void)stream;
|
||||||
|
(void)effect;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int out_remove_audio_effect(const struct audio_stream *stream, effect_handle_t effect)
|
static int out_remove_audio_effect(const struct audio_stream *stream, effect_handle_t effect)
|
||||||
{
|
{
|
||||||
|
(void)stream;
|
||||||
|
(void)effect;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int out_get_next_write_timestamp(const struct audio_stream_out *stream,
|
static int out_get_next_write_timestamp(const struct audio_stream_out *stream,
|
||||||
int64_t *timestamp)
|
int64_t *timestamp)
|
||||||
{
|
{
|
||||||
|
(void)stream;
|
||||||
|
(void)timestamp;
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1909,6 +1930,8 @@ 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)
|
static int in_set_sample_rate(struct audio_stream *stream, uint32_t rate)
|
||||||
{
|
{
|
||||||
|
(void)stream;
|
||||||
|
(void)rate;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1934,11 +1957,14 @@ 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)
|
static audio_format_t in_get_format(const struct audio_stream *stream)
|
||||||
{
|
{
|
||||||
|
(void)stream;
|
||||||
return AUDIO_FORMAT_PCM_16_BIT;
|
return AUDIO_FORMAT_PCM_16_BIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int in_set_format(struct audio_stream *stream, audio_format_t format)
|
static int in_set_format(struct audio_stream *stream, audio_format_t format)
|
||||||
{
|
{
|
||||||
|
(void)stream;
|
||||||
|
(void)format;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1988,6 +2014,8 @@ static int in_standby(struct audio_stream *stream)
|
||||||
|
|
||||||
static int in_dump(const struct audio_stream *stream, int fd)
|
static int in_dump(const struct audio_stream *stream, int fd)
|
||||||
{
|
{
|
||||||
|
(void)stream;
|
||||||
|
(void)fd;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1996,7 +2024,6 @@ static int in_set_parameters(struct audio_stream *stream, const char *kvpairs)
|
||||||
struct sunxi_stream_in *in = (struct sunxi_stream_in *)stream;
|
struct sunxi_stream_in *in = (struct sunxi_stream_in *)stream;
|
||||||
struct sunxi_audio_device *adev = in->dev;
|
struct sunxi_audio_device *adev = in->dev;
|
||||||
struct str_parms *parms;
|
struct str_parms *parms;
|
||||||
char *str;
|
|
||||||
char value[128];
|
char value[128];
|
||||||
int ret, val = 0;
|
int ret, val = 0;
|
||||||
bool do_standby = false;
|
bool do_standby = false;
|
||||||
|
@ -2043,14 +2070,18 @@ static int in_set_parameters(struct audio_stream *stream, const char *kvpairs)
|
||||||
static char * in_get_parameters(const struct audio_stream *stream,
|
static char * in_get_parameters(const struct audio_stream *stream,
|
||||||
const char *keys)
|
const char *keys)
|
||||||
{
|
{
|
||||||
|
(void)stream;
|
||||||
|
(void)keys;
|
||||||
return strdup("");
|
return strdup("");
|
||||||
}
|
}
|
||||||
|
|
||||||
static int in_set_gain(struct audio_stream_in *stream, float gain)
|
static int in_set_gain(struct audio_stream_in *stream, float gain)
|
||||||
{
|
{
|
||||||
|
(void)stream;
|
||||||
|
(void)gain;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#if 0
|
||||||
static void get_capture_delay(struct sunxi_stream_in *in,
|
static void get_capture_delay(struct sunxi_stream_in *in,
|
||||||
size_t frames,
|
size_t frames,
|
||||||
struct echo_reference_buffer *buffer)
|
struct echo_reference_buffer *buffer)
|
||||||
|
@ -2096,7 +2127,6 @@ static void get_capture_delay(struct sunxi_stream_in *in,
|
||||||
kernel_delay, buf_delay, rsmp_delay, kernel_frames,
|
kernel_delay, buf_delay, rsmp_delay, kernel_frames,
|
||||||
in->frames_in, in->proc_frames_in, frames);
|
in->frames_in, in->proc_frames_in, frames);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t update_echo_reference(struct sunxi_stream_in *in, size_t frames)
|
static int32_t update_echo_reference(struct sunxi_stream_in *in, size_t frames)
|
||||||
{
|
{
|
||||||
struct echo_reference_buffer b;
|
struct echo_reference_buffer b;
|
||||||
|
@ -2129,7 +2159,6 @@ static int32_t update_echo_reference(struct sunxi_stream_in *in, size_t frames)
|
||||||
|
|
||||||
return b.delay_ns;
|
return b.delay_ns;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int set_preprocessor_param(effect_handle_t handle,
|
static int set_preprocessor_param(effect_handle_t handle,
|
||||||
effect_param_t *param)
|
effect_param_t *param)
|
||||||
{
|
{
|
||||||
|
@ -2148,7 +2177,6 @@ static int set_preprocessor_param(effect_handle_t handle,
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int set_preprocessor_echo_delay(effect_handle_t handle,
|
static int set_preprocessor_echo_delay(effect_handle_t handle,
|
||||||
int32_t delay_us)
|
int32_t delay_us)
|
||||||
{
|
{
|
||||||
|
@ -2194,7 +2222,7 @@ static void push_echo_reference(struct sunxi_stream_in *in, size_t frames)
|
||||||
in->ref_frames_in * in->config.channels * sizeof(int16_t));
|
in->ref_frames_in * in->config.channels * sizeof(int16_t));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
static int get_next_buffer(struct resampler_buffer_provider *buffer_provider,
|
static int get_next_buffer(struct resampler_buffer_provider *buffer_provider,
|
||||||
struct resampler_buffer* buffer)
|
struct resampler_buffer* buffer)
|
||||||
{
|
{
|
||||||
|
@ -2217,7 +2245,7 @@ static int get_next_buffer(struct resampler_buffer_provider *buffer_provider,
|
||||||
in->read_status = pcm_read(in->pcm,
|
in->read_status = pcm_read(in->pcm,
|
||||||
(void*)in->buffer,
|
(void*)in->buffer,
|
||||||
in->config.period_size *
|
in->config.period_size *
|
||||||
audio_stream_frame_size(&in->stream.common));
|
audio_stream_in_frame_size((struct audio_stream_in*)&in->stream.common));
|
||||||
if (in->read_status != 0) {
|
if (in->read_status != 0) {
|
||||||
ALOGE("get_next_buffer() pcm_read error %d, %s", in->read_status, strerror(errno));
|
ALOGE("get_next_buffer() pcm_read error %d, %s", in->read_status, strerror(errno));
|
||||||
buffer->raw = NULL;
|
buffer->raw = NULL;
|
||||||
|
@ -2261,19 +2289,19 @@ static ssize_t read_frames(struct sunxi_stream_in *in, void *buffer, ssize_t fra
|
||||||
if (in->resampler != NULL) {
|
if (in->resampler != NULL) {
|
||||||
in->resampler->resample_from_provider(in->resampler,
|
in->resampler->resample_from_provider(in->resampler,
|
||||||
(int16_t *)((char *)buffer +
|
(int16_t *)((char *)buffer +
|
||||||
frames_wr * audio_stream_frame_size(&in->stream.common)),
|
frames_wr * audio_stream_in_frame_size((struct audio_stream_in*)&in->stream.common)),
|
||||||
&frames_rd);
|
&frames_rd);
|
||||||
} else {
|
} else {
|
||||||
struct resampler_buffer buf = {
|
struct resampler_buffer buf = {
|
||||||
{ raw : NULL, },
|
{ .raw = NULL, },
|
||||||
frame_count : frames_rd,
|
.frame_count = frames_rd,
|
||||||
};
|
};
|
||||||
get_next_buffer(&in->buf_provider, &buf);
|
get_next_buffer(&in->buf_provider, &buf);
|
||||||
if (buf.raw != NULL) {
|
if (buf.raw != NULL) {
|
||||||
memcpy((char *)buffer +
|
memcpy((char *)buffer +
|
||||||
frames_wr * audio_stream_frame_size(&in->stream.common),
|
frames_wr * audio_stream_in_frame_size((struct audio_stream_in*)&in->stream.common),
|
||||||
buf.raw,
|
buf.raw,
|
||||||
buf.frame_count * audio_stream_frame_size(&in->stream.common));
|
buf.frame_count * audio_stream_in_frame_size((struct audio_stream_in*)&in->stream.common));
|
||||||
frames_rd = buf.frame_count;
|
frames_rd = buf.frame_count;
|
||||||
}
|
}
|
||||||
release_buffer(&in->buf_provider, &buf);
|
release_buffer(&in->buf_provider, &buf);
|
||||||
|
@ -2288,7 +2316,7 @@ static ssize_t read_frames(struct sunxi_stream_in *in, void *buffer, ssize_t fra
|
||||||
}
|
}
|
||||||
return frames_wr;
|
return frames_wr;
|
||||||
}
|
}
|
||||||
|
#if 0
|
||||||
/* process_frames() reads frames from kernel driver (via read_frames()),
|
/* process_frames() reads frames from kernel driver (via read_frames()),
|
||||||
* calls the active audio pre processings and output the number of frames requested
|
* calls the active audio pre processings and output the number of frames requested
|
||||||
* to the buffer specified */
|
* to the buffer specified */
|
||||||
|
@ -2356,14 +2384,14 @@ static ssize_t process_frames(struct sunxi_stream_in *in, void* buffer, ssize_t
|
||||||
}
|
}
|
||||||
return frames_wr;
|
return frames_wr;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
static ssize_t in_read(struct audio_stream_in *stream, void* buffer,
|
static ssize_t in_read(struct audio_stream_in *stream, void* buffer,
|
||||||
size_t bytes)
|
size_t bytes)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct sunxi_stream_in *in = (struct sunxi_stream_in *)stream;
|
struct sunxi_stream_in *in = (struct sunxi_stream_in *)stream;
|
||||||
struct sunxi_audio_device *adev = in->dev;
|
struct sunxi_audio_device *adev = in->dev;
|
||||||
size_t frames_rq = bytes / audio_stream_frame_size(&stream->common);
|
size_t frames_rq = bytes / audio_stream_in_frame_size((struct audio_stream_in *)&stream->common);
|
||||||
int is_first_data = 0;
|
int is_first_data = 0;
|
||||||
|
|
||||||
if (adev->mode == AUDIO_MODE_IN_CALL) {
|
if (adev->mode == AUDIO_MODE_IN_CALL) {
|
||||||
|
@ -2442,7 +2470,7 @@ static ssize_t in_read(struct audio_stream_in *stream, void* buffer,
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
usleep(bytes * 1000000 / audio_stream_frame_size(&stream->common) /
|
usleep(bytes * 1000000 / audio_stream_in_frame_size((struct audio_stream_in*)&stream->common) /
|
||||||
in_get_sample_rate(&stream->common));
|
in_get_sample_rate(&stream->common));
|
||||||
|
|
||||||
pthread_mutex_unlock(&in->lock);
|
pthread_mutex_unlock(&in->lock);
|
||||||
|
@ -2451,6 +2479,7 @@ exit:
|
||||||
|
|
||||||
static uint32_t in_get_input_frames_lost(struct audio_stream_in *stream)
|
static uint32_t in_get_input_frames_lost(struct audio_stream_in *stream)
|
||||||
{
|
{
|
||||||
|
(void)stream;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2539,8 +2568,12 @@ static int adev_open_output_stream(struct audio_hw_device *dev,
|
||||||
audio_devices_t devices,
|
audio_devices_t devices,
|
||||||
audio_output_flags_t flags,
|
audio_output_flags_t flags,
|
||||||
struct audio_config *config,
|
struct audio_config *config,
|
||||||
struct audio_stream_out **stream_out)
|
struct audio_stream_out **stream_out,
|
||||||
|
const char *address)
|
||||||
{
|
{
|
||||||
|
(void)handle;
|
||||||
|
(void)devices;
|
||||||
|
(void)address;
|
||||||
struct sunxi_audio_device *ladev = (struct sunxi_audio_device *)dev;
|
struct sunxi_audio_device *ladev = (struct sunxi_audio_device *)dev;
|
||||||
struct sunxi_stream_out *out;
|
struct sunxi_stream_out *out;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -2595,7 +2628,6 @@ static int adev_open_output_stream(struct audio_hw_device *dev,
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err_open:
|
|
||||||
free(out);
|
free(out);
|
||||||
*stream_out = NULL;
|
*stream_out = NULL;
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -2604,6 +2636,7 @@ err_open:
|
||||||
static void adev_close_output_stream(struct audio_hw_device *dev,
|
static void adev_close_output_stream(struct audio_hw_device *dev,
|
||||||
struct audio_stream_out *stream)
|
struct audio_stream_out *stream)
|
||||||
{
|
{
|
||||||
|
(void)dev;
|
||||||
struct sunxi_stream_out *out = (struct sunxi_stream_out *)stream;
|
struct sunxi_stream_out *out = (struct sunxi_stream_out *)stream;
|
||||||
struct sunxi_audio_device *adev = out->dev;
|
struct sunxi_audio_device *adev = out->dev;
|
||||||
|
|
||||||
|
@ -2628,7 +2661,6 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs)
|
||||||
{
|
{
|
||||||
struct sunxi_audio_device *adev = (struct sunxi_audio_device *)dev;
|
struct sunxi_audio_device *adev = (struct sunxi_audio_device *)dev;
|
||||||
struct str_parms *parms;
|
struct str_parms *parms;
|
||||||
char *str;
|
|
||||||
char value[32];
|
char value[32];
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -2676,6 +2708,7 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs)
|
||||||
static char * adev_get_parameters(const struct audio_hw_device *dev,
|
static char * adev_get_parameters(const struct audio_hw_device *dev,
|
||||||
const char *keys)
|
const char *keys)
|
||||||
{
|
{
|
||||||
|
(void)dev;
|
||||||
if (!strcmp(keys, "routing"))
|
if (!strcmp(keys, "routing"))
|
||||||
{
|
{
|
||||||
char prop_value[512];
|
char prop_value[512];
|
||||||
|
@ -2689,6 +2722,7 @@ static char * adev_get_parameters(const struct audio_hw_device *dev,
|
||||||
|
|
||||||
static int adev_init_check(const struct audio_hw_device *dev)
|
static int adev_init_check(const struct audio_hw_device *dev)
|
||||||
{
|
{
|
||||||
|
(void)dev;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2704,7 +2738,6 @@ static int adev_set_voice_volume(struct audio_hw_device *dev, float volume)
|
||||||
} else if (adev->mode == AUDIO_MODE_IN_CALL) {
|
} else if (adev->mode == AUDIO_MODE_IN_CALL) {
|
||||||
int level;
|
int level;
|
||||||
int speaker_on=0,headset_on=0 ,headphone_on=0,earpiece_on=0;
|
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);
|
int volume_codec = (int)(volume*100/10);
|
||||||
speaker_on = adev->out_device & AUDIO_DEVICE_OUT_SPEAKER;
|
speaker_on = adev->out_device & AUDIO_DEVICE_OUT_SPEAKER;
|
||||||
headset_on = adev->out_device & AUDIO_DEVICE_OUT_WIRED_HEADSET; // with mic
|
headset_on = adev->out_device & AUDIO_DEVICE_OUT_WIRED_HEADSET; // with mic
|
||||||
|
@ -2745,19 +2778,23 @@ static int adev_set_voice_volume(struct audio_hw_device *dev, float volume)
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#if 0
|
||||||
static int adev_set_master_volume(struct audio_hw_device *dev, float volume)
|
static int adev_set_master_volume(struct audio_hw_device *dev, float volume)
|
||||||
{
|
{
|
||||||
|
(void)dev;
|
||||||
|
(void)volume;
|
||||||
F_LOG;
|
F_LOG;
|
||||||
return -ENOSYS;
|
return -ENOSYS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int adev_get_master_volume(struct audio_hw_device *dev, float *volume)
|
static int adev_get_master_volume(struct audio_hw_device *dev, float *volume)
|
||||||
{
|
{
|
||||||
|
(void)dev;
|
||||||
|
(void)volume;
|
||||||
F_LOG;
|
F_LOG;
|
||||||
return -ENOSYS;
|
return -ENOSYS;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
static int adev_set_mode(struct audio_hw_device *dev, audio_mode_t mode)
|
static int adev_set_mode(struct audio_hw_device *dev, audio_mode_t mode)
|
||||||
{
|
{
|
||||||
struct sunxi_audio_device *adev = (struct sunxi_audio_device *)dev;
|
struct sunxi_audio_device *adev = (struct sunxi_audio_device *)dev;
|
||||||
|
@ -2793,7 +2830,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,
|
static size_t adev_get_input_buffer_size(const struct audio_hw_device *dev,
|
||||||
const struct audio_config *config)
|
const struct audio_config *config)
|
||||||
{
|
{
|
||||||
size_t size;
|
(void)dev;
|
||||||
int channel_count = popcount(config->channel_mask);
|
int channel_count = popcount(config->channel_mask);
|
||||||
if (check_input_parameters(config->sample_rate, config->format, channel_count) != 0)
|
if (check_input_parameters(config->sample_rate, config->format, channel_count) != 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -2805,8 +2842,16 @@ static int adev_open_input_stream(struct audio_hw_device *dev,
|
||||||
audio_io_handle_t handle,
|
audio_io_handle_t handle,
|
||||||
audio_devices_t devices,
|
audio_devices_t devices,
|
||||||
struct audio_config *config,
|
struct audio_config *config,
|
||||||
struct audio_stream_in **stream_in)
|
struct audio_stream_in **stream_in,
|
||||||
|
audio_input_flags_t flags,
|
||||||
|
const char* addr,
|
||||||
|
audio_source_t source)
|
||||||
{
|
{
|
||||||
|
(void)handle;
|
||||||
|
(void)dev;
|
||||||
|
(void)flags;
|
||||||
|
(void)addr;
|
||||||
|
(void)source;
|
||||||
struct sunxi_audio_device *ladev = (struct sunxi_audio_device *)dev;
|
struct sunxi_audio_device *ladev = (struct sunxi_audio_device *)dev;
|
||||||
struct sunxi_stream_in *in;
|
struct sunxi_stream_in *in;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -2845,16 +2890,16 @@ static int adev_open_input_stream(struct audio_hw_device *dev,
|
||||||
//in->config.in_init_channels = channel_count;
|
//in->config.in_init_channels = channel_count;
|
||||||
|
|
||||||
ALOGV("to malloc in-buffer: period_size: %d, frame_size: %d",
|
ALOGV("to malloc in-buffer: period_size: %d, frame_size: %d",
|
||||||
in->config.period_size, audio_stream_frame_size(&in->stream.common));
|
in->config.period_size, (int)audio_stream_in_frame_size((struct audio_stream_in*)&in->stream.common));
|
||||||
in->buffer = malloc(in->config.period_size *
|
in->buffer = malloc(in->config.period_size *
|
||||||
audio_stream_frame_size(&in->stream.common) * 8);
|
audio_stream_in_frame_size((struct audio_stream_in*)&in->stream.common) * 8);
|
||||||
|
|
||||||
if (!in->buffer) {
|
if (!in->buffer) {
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
memset(in->buffer, 0, in->config.period_size *
|
memset(in->buffer, 0, in->config.period_size *
|
||||||
audio_stream_frame_size(&in->stream.common) * 8); //mute
|
audio_stream_in_frame_size((struct audio_stream_in*)&in->stream.common) * 8); //mute
|
||||||
|
|
||||||
ladev->af_capture_flag = false;
|
ladev->af_capture_flag = false;
|
||||||
//devices = AUDIO_DEVICE_IN_WIFI_DISPLAY;//for test
|
//devices = AUDIO_DEVICE_IN_WIFI_DISPLAY;//for test
|
||||||
|
@ -2936,29 +2981,43 @@ int adev_create_audio_patch(struct audio_hw_device *dev,
|
||||||
const struct audio_port_config *sinks,
|
const struct audio_port_config *sinks,
|
||||||
audio_patch_handle_t *handle)
|
audio_patch_handle_t *handle)
|
||||||
{
|
{
|
||||||
|
(void)dev;
|
||||||
|
(void)num_sources;
|
||||||
|
(void)sources;
|
||||||
|
(void)num_sinks;
|
||||||
|
(void)sinks;
|
||||||
|
(void)handle;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int adev_release_audio_patch(struct audio_hw_device *dev,
|
int adev_release_audio_patch(struct audio_hw_device *dev,
|
||||||
audio_patch_handle_t handle)
|
audio_patch_handle_t handle)
|
||||||
{
|
{
|
||||||
|
(void)dev;
|
||||||
|
(void)handle;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int adev_get_audio_port(struct audio_hw_device *dev,
|
int adev_get_audio_port(struct audio_hw_device *dev,
|
||||||
struct audio_port *port)
|
struct audio_port *port)
|
||||||
{
|
{
|
||||||
|
(void)dev;
|
||||||
|
(void)port;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int adev_set_audio_port_config(struct audio_hw_device *dev,
|
int adev_set_audio_port_config(struct audio_hw_device *dev,
|
||||||
const struct audio_port_config *config)
|
const struct audio_port_config *config)
|
||||||
{
|
{
|
||||||
|
(void)dev;
|
||||||
|
(void)config;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int adev_dump(const audio_hw_device_t *device, int fd)
|
static int adev_dump(const audio_hw_device_t *device, int fd)
|
||||||
{
|
{
|
||||||
|
(void)device;
|
||||||
|
(void)fd;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3036,7 +3095,6 @@ static int adev_open(const hw_module_t* module, const char* name,
|
||||||
hw_device_t** device)
|
hw_device_t** device)
|
||||||
{
|
{
|
||||||
struct sunxi_audio_device *adev;
|
struct sunxi_audio_device *adev;
|
||||||
int ret;
|
|
||||||
|
|
||||||
if (strcmp(name, AUDIO_HARDWARE_INTERFACE) != 0)
|
if (strcmp(name, AUDIO_HARDWARE_INTERFACE) != 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -3112,7 +3170,6 @@ static int adev_open(const hw_module_t* module, const char* name,
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error_out:
|
|
||||||
free(adev);
|
free(adev);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@ void codec_dev_exit()
|
||||||
//normal play and record
|
//normal play and record
|
||||||
void normal_play_enable(bool enable)
|
void normal_play_enable(bool enable)
|
||||||
{
|
{
|
||||||
|
(void)enable;
|
||||||
// init volume
|
// init volume
|
||||||
//disable other mode
|
//disable other mode
|
||||||
}
|
}
|
||||||
|
@ -78,7 +79,7 @@ void normal_record_route(int path)
|
||||||
|
|
||||||
//FM play and record
|
//FM play and record
|
||||||
void fm_play_enable(bool enable){
|
void fm_play_enable(bool enable){
|
||||||
|
(void)enable;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,7 +116,7 @@ void fm_volume(int path,int volume)
|
||||||
|
|
||||||
//Factory test
|
//Factory test
|
||||||
void factory_enable(bool enable){
|
void factory_enable(bool enable){
|
||||||
|
(void)enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
void factory_route(int path){
|
void factory_route(int path){
|
||||||
|
@ -127,15 +128,15 @@ void factory_route(int path){
|
||||||
|
|
||||||
//Ringtone
|
//Ringtone
|
||||||
void ringtone_enable(bool enable){
|
void ringtone_enable(bool enable){
|
||||||
|
(void)enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ringtone_path(int path){
|
void ringtone_path(int path){
|
||||||
|
(void)path;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ringtone_volume(float volume){
|
void ringtone_volume(float volume){
|
||||||
|
(void)volume;
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear_phone_route()
|
void clear_phone_route()
|
||||||
|
@ -148,7 +149,7 @@ void clear_phone_route()
|
||||||
|
|
||||||
//phone play and record
|
//phone play and record
|
||||||
void phone_play_enable(bool enable){
|
void phone_play_enable(bool enable){
|
||||||
|
(void)enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
void phone_play_route(int path)
|
void phone_play_route(int path)
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
|
|
||||||
static int set_normal_volume(struct codec_client *client, int path, int vol)
|
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;
|
int headset_on=0, headphone_on=0, speaker_on=0;
|
||||||
|
|
||||||
headset_on = path & AUDIO_DEVICE_OUT_WIRED_HEADSET; // hp4p
|
headset_on = path & AUDIO_DEVICE_OUT_WIRED_HEADSET; // hp4p
|
||||||
|
@ -40,7 +42,6 @@ static int set_normal_path(struct codec_client *client, int path)
|
||||||
{
|
{
|
||||||
int switch_to_headset =0;
|
int switch_to_headset =0;
|
||||||
int ret = -1, fd=0;
|
int ret = -1, fd=0;
|
||||||
char prop_value[20]={0};
|
|
||||||
char h2w_state[2]={0};
|
char h2w_state[2]={0};
|
||||||
int headset_on=0, headphone_on=0, speaker_on=0, earpiece_on=0;
|
int headset_on=0, headphone_on=0, speaker_on=0, earpiece_on=0;
|
||||||
|
|
||||||
|
@ -123,6 +124,8 @@ static int set_normal_path(struct codec_client *client, int path)
|
||||||
|
|
||||||
static int set_normal_record_enable(struct codec_client *client, bool enable)
|
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_linein_record, 0, 0);
|
||||||
//mixer_ctl_set_value(client->mixer_ctls->audio_phone_voice_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__);
|
ALOGV("normal record mode 4,****LINE:%d,FUNC:%s",__LINE__,__FUNCTION__);
|
||||||
|
@ -165,11 +168,9 @@ 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)
|
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 speaker_vol=0, headset_vol=0;
|
int speaker_vol=0, headset_vol=0;
|
||||||
int val = 0;
|
int val = 0;
|
||||||
|
@ -217,6 +218,7 @@ static int set_fm_volume(struct codec_client *client, int path, int volume)
|
||||||
|
|
||||||
static int set_fm_path(struct codec_client *client, int path)
|
static int set_fm_path(struct codec_client *client, int path)
|
||||||
{
|
{
|
||||||
|
(void)client;
|
||||||
int headset_on=0, headphone_on=0, speaker_on=0;
|
int headset_on=0, headphone_on=0, speaker_on=0;
|
||||||
|
|
||||||
headset_on = path & AUDIO_DEVICE_OUT_WIRED_HEADSET; // hp4p
|
headset_on = path & AUDIO_DEVICE_OUT_WIRED_HEADSET; // hp4p
|
||||||
|
@ -238,6 +240,7 @@ static int set_fm_path(struct codec_client *client, int path)
|
||||||
}
|
}
|
||||||
static int set_fm_record_enable(struct codec_client *client, bool enable)
|
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);
|
//mixer_ctl_set_value(client->mixer_ctls->audio_phone_voice_record, 0, 0);
|
||||||
|
|
||||||
if (enable){
|
if (enable){
|
||||||
|
@ -251,6 +254,8 @@ static int set_fm_record_enable(struct codec_client *client, bool enable)
|
||||||
|
|
||||||
static int set_fm_record(struct codec_client *client, int path)
|
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__);
|
ALOGV("FM record mode 4, ****LINE:%d,FUNC:%s", __LINE__,__FUNCTION__);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -197,10 +197,7 @@ int plan_one_mixer_buf(char *buf, int bytes)
|
||||||
|
|
||||||
int plan_one_start_bt_record(void)
|
int plan_one_start_bt_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));
|
memset(&(record_data), 0, sizeof(struct record_data));
|
||||||
|
|
||||||
|
@ -377,7 +374,6 @@ static int stream_transfer(struct stream_transfer *stream_transfer)
|
||||||
struct dev_stream *stream_receiver;
|
struct dev_stream *stream_receiver;
|
||||||
int size_transfer = 0;
|
int size_transfer = 0;
|
||||||
int ret =0;
|
int ret =0;
|
||||||
int exit_flag =0;
|
|
||||||
int i =0;
|
int i =0;
|
||||||
short* Srcptr;
|
short* Srcptr;
|
||||||
short* Drcptr;
|
short* Drcptr;
|
||||||
|
@ -388,7 +384,7 @@ static int stream_transfer(struct stream_transfer *stream_transfer)
|
||||||
|
|
||||||
|
|
||||||
#ifdef START_ZERO_BUFFER
|
#ifdef START_ZERO_BUFFER
|
||||||
/* 消除开头杂音 */
|
/* ??????ͷ???? */
|
||||||
memset(stream_sender->buf, 0, stream_sender->buf_size);
|
memset(stream_sender->buf, 0, stream_sender->buf_size);
|
||||||
pcm_write(stream_receiver->dev, stream_sender->buf, stream_sender->buf_size);
|
pcm_write(stream_receiver->dev, stream_sender->buf, stream_sender->buf_size);
|
||||||
#endif
|
#endif
|
||||||
|
@ -435,7 +431,7 @@ static int stream_transfer(struct stream_transfer *stream_transfer)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stream_transfer->record_flag == 1){
|
if (stream_transfer->record_flag == 1){
|
||||||
//是上行,还是下行.
|
//??????,????????.
|
||||||
if (stream_transfer->voice_direction == UPSTREAM){
|
if (stream_transfer->voice_direction == UPSTREAM){
|
||||||
Srcptr = (short*)(stream_sender->buf);
|
Srcptr = (short*)(stream_sender->buf);
|
||||||
Drcptr = (short*)(record_data.record_buf + (record_data.lenwriteup%record_data.record_lenth));
|
Drcptr = (short*)(record_data.record_buf + (record_data.lenwriteup%record_data.record_lenth));
|
||||||
|
|
|
@ -17,11 +17,12 @@
|
||||||
#include "plan_one.h"
|
#include "plan_one.h"
|
||||||
|
|
||||||
static int no_earpiece = 0;
|
static int no_earpiece = 0;
|
||||||
static bool last_path_is_bt = false ;
|
|
||||||
static bool end_call = false;
|
static bool end_call = false;
|
||||||
|
|
||||||
static int set_normal_volume(struct codec_client *client, int path, int vol)
|
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;
|
int headset_on=0, headphone_on=0, speaker_on=0;
|
||||||
|
|
||||||
headset_on = path & AUDIO_DEVICE_OUT_WIRED_HEADSET; // hp4p
|
headset_on = path & AUDIO_DEVICE_OUT_WIRED_HEADSET; // hp4p
|
||||||
|
@ -41,9 +42,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)
|
static int set_normal_path(struct codec_client *client, int path)
|
||||||
{
|
{
|
||||||
|
(void)client;
|
||||||
int switch_to_headset =0;
|
int switch_to_headset =0;
|
||||||
int ret = -1, fd=0;
|
int ret = -1, fd=0;
|
||||||
char prop_value[20]={0};
|
|
||||||
char h2w_state[2]={0};
|
char h2w_state[2]={0};
|
||||||
int headset_on=0, headphone_on=0, speaker_on=0, earpiece_on=0;
|
int headset_on=0, headphone_on=0, speaker_on=0, earpiece_on=0;
|
||||||
|
|
||||||
|
@ -94,6 +95,8 @@ ALOGV("huangxin---------------------------%d,%s,path:%d, headset_on:%d, headphon
|
||||||
|
|
||||||
static int set_normal_record_enable(struct codec_client *client, bool enable)
|
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_linein_record, 0, 0);
|
||||||
//mixer_ctl_set_value(client->mixer_ctls->audio_phone_voice_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__);
|
ALOGV("normal record mode 4,****LINE:%d,FUNC:%s",__LINE__,__FUNCTION__);
|
||||||
|
@ -102,6 +105,7 @@ static int set_normal_record_enable(struct codec_client *client, bool enable)
|
||||||
|
|
||||||
static int set_normal_record(struct codec_client *client, int path)
|
static int set_normal_record(struct codec_client *client, int path)
|
||||||
{
|
{
|
||||||
|
(void)client;
|
||||||
ALOGV("normal record mode 4,****LINE:%d,FUNC:%s",__LINE__,__FUNCTION__);
|
ALOGV("normal record mode 4,****LINE:%d,FUNC:%s",__LINE__,__FUNCTION__);
|
||||||
int headset_on=0;
|
int headset_on=0;
|
||||||
headset_on = path & AUDIO_DEVICE_IN_WIRED_HEADSET;
|
headset_on = path & AUDIO_DEVICE_IN_WIRED_HEADSET;
|
||||||
|
@ -117,6 +121,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)
|
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;
|
int level;
|
||||||
|
|
||||||
|
@ -153,6 +158,7 @@ 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 fm_last_dev=0; // 1 = speaker, 2= headset;
|
||||||
static int set_fm_path(struct codec_client *client, int path)
|
static int set_fm_path(struct codec_client *client, int path)
|
||||||
{
|
{
|
||||||
|
(void)client;
|
||||||
int headset_on=0, headphone_on=0, speaker_on=0;
|
int headset_on=0, headphone_on=0, speaker_on=0;
|
||||||
|
|
||||||
headset_on = path & AUDIO_DEVICE_OUT_WIRED_HEADSET; // hp4p
|
headset_on = path & AUDIO_DEVICE_OUT_WIRED_HEADSET; // hp4p
|
||||||
|
@ -190,6 +196,7 @@ static int set_fm_path(struct codec_client *client, int path)
|
||||||
}
|
}
|
||||||
static int set_fm_record_enable(struct codec_client *client, bool enable)
|
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);
|
//mixer_ctl_set_value(client->mixer_ctls->audio_phone_voice_record, 0, 0);
|
||||||
|
|
||||||
if (enable){
|
if (enable){
|
||||||
|
@ -203,6 +210,8 @@ static int set_fm_record_enable(struct codec_client *client, bool enable)
|
||||||
|
|
||||||
static int set_fm_record(struct codec_client *client, int path)
|
static int set_fm_record(struct codec_client *client, int path)
|
||||||
{
|
{
|
||||||
|
(void)client;
|
||||||
|
(void)path;
|
||||||
#if 0
|
#if 0
|
||||||
int headset_on=0, headphone_on=0, speaker_on=0;
|
int headset_on=0, headphone_on=0, speaker_on=0;
|
||||||
|
|
||||||
|
@ -226,12 +235,17 @@ static int set_fm_record(struct codec_client *client, int path)
|
||||||
|
|
||||||
static int set_factory_volume(struct codec_client *client, int path, int vol)
|
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__);
|
ALOGV("****LINE:%d,FUNC:%s",__LINE__,__FUNCTION__);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int set_factory_path(struct codec_client *client, int path)
|
static int set_factory_path(struct codec_client *client, int path)
|
||||||
{
|
{
|
||||||
|
(void)client;
|
||||||
|
(void)path;
|
||||||
#if 0
|
#if 0
|
||||||
mixer_ctl_set_value(client->mixer_ctls->audio_phone_end_call, 0, 1);
|
mixer_ctl_set_value(client->mixer_ctls->audio_phone_end_call, 0, 1);
|
||||||
|
|
||||||
|
@ -269,9 +283,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)
|
static int set_phone_volume(struct codec_client *client, int path, int volume)
|
||||||
{
|
{
|
||||||
|
(void)client;
|
||||||
int level;
|
int level;
|
||||||
int speaker_on=0,headset_on=0 ,headphone_on=0,earpiece_on=0;
|
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;
|
speaker_on = path & AUDIO_DEVICE_OUT_SPEAKER;
|
||||||
headset_on = path & AUDIO_DEVICE_OUT_WIRED_HEADSET; // with mic
|
headset_on = path & AUDIO_DEVICE_OUT_WIRED_HEADSET; // with mic
|
||||||
|
@ -314,13 +328,11 @@ static int set_phone_volume(struct codec_client *client, int path, int volume)
|
||||||
|
|
||||||
|
|
||||||
static bool is_in_record = false;
|
static bool is_in_record = false;
|
||||||
static bool bluetooth_in_record = false;
|
|
||||||
|
|
||||||
static int set_phone_path(struct codec_client *client, int path)
|
static int set_phone_path(struct codec_client *client, int path)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
(void)client;
|
||||||
int earpiece_on=0, headset_on=0, headphone_on=0, bt_on=0, speaker_on=0;
|
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
|
headset_on = path & AUDIO_DEVICE_OUT_WIRED_HEADSET; // hp4p
|
||||||
headphone_on = path & AUDIO_DEVICE_OUT_WIRED_HEADPHONE; // hp3p
|
headphone_on = path & AUDIO_DEVICE_OUT_WIRED_HEADPHONE; // hp3p
|
||||||
|
@ -418,8 +430,8 @@ ALOGV("huangxin----****LINE:%d,FUNC:%s,headset_on:%d, headphone_on:%d, speaker_o
|
||||||
ALOGV("in bluetooth ****LINE:%d,FUNC:%s",__LINE__,__FUNCTION__);
|
ALOGV("in bluetooth ****LINE:%d,FUNC:%s",__LINE__,__FUNCTION__);
|
||||||
mixer_ctl_set_value(client->mixer_ctls->audio_bt_clk_fmt, 0, 1);
|
mixer_ctl_set_value(client->mixer_ctls->audio_bt_clk_fmt, 0, 1);
|
||||||
/*
|
/*
|
||||||
* 上行: analog_bt_mic->analog_phoneout
|
* ????: analog_bt_mic->analog_phoneout
|
||||||
* 下行: analog_bt_phonein->bt_out
|
* ????: 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_mic, 0, 1);
|
||||||
mixer_ctl_set_value(client->mixer_ctls->audio_analog_bt_phonein, 0, 1);
|
mixer_ctl_set_value(client->mixer_ctls->audio_analog_bt_phonein, 0, 1);
|
||||||
|
@ -438,6 +450,7 @@ 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)
|
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);
|
// mixer_ctl_set_value(client->mixer_ctls->audio_linein_record, 0, 0);
|
||||||
|
|
||||||
if (enable){
|
if (enable){
|
||||||
|
@ -455,12 +468,15 @@ static int set_phone_record_enable(struct codec_client *client, bool enable)
|
||||||
|
|
||||||
static int set_phone_record(struct codec_client *client, int path)
|
static int set_phone_record(struct codec_client *client, int path)
|
||||||
{
|
{
|
||||||
|
(void)client;
|
||||||
|
(void)path;
|
||||||
ALOGV("****LINE:%d,FUNC:%s",__LINE__,__FUNCTION__);
|
ALOGV("****LINE:%d,FUNC:%s",__LINE__,__FUNCTION__);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int record_read_pcm_buf(struct codec_client *client, void* buffer, int bytes)
|
static int record_read_pcm_buf(struct codec_client *client, void* buffer, int bytes)
|
||||||
{
|
{
|
||||||
|
(void)client;
|
||||||
ALOGV("1****LINE:%d,FUNC:%s",__LINE__,__FUNCTION__);
|
ALOGV("1****LINE:%d,FUNC:%s",__LINE__,__FUNCTION__);
|
||||||
|
|
||||||
return plan_one_mixer_buf(buffer, bytes);
|
return plan_one_mixer_buf(buffer, bytes);
|
||||||
|
@ -495,6 +511,7 @@ void plan_one_exit(void)
|
||||||
}
|
}
|
||||||
static int clean_phone_path (struct codec_client *client)
|
static int clean_phone_path (struct codec_client *client)
|
||||||
{
|
{
|
||||||
|
(void)client;
|
||||||
ALOGV("***********%d,********%s********\n", __LINE__,__FUNCTION__);
|
ALOGV("***********%d,********%s********\n", __LINE__,__FUNCTION__);
|
||||||
//mixer_ctl_set_value(client->mixer_ctls->audio_phone_end_call, 0, 1);
|
//mixer_ctl_set_value(client->mixer_ctls->audio_phone_end_call, 0, 1);
|
||||||
end_call = true;
|
end_call = true;
|
||||||
|
|
|
@ -58,11 +58,6 @@ static struct stream_transfer g_bt_download_voice ;
|
||||||
static struct stream_transfer g_bp_upload_voice ;
|
static struct stream_transfer g_bp_upload_voice ;
|
||||||
static struct stream_transfer g_bp_download_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 void *manage_voice_thread(void *param);
|
||||||
|
|
||||||
static int stream_transfer(struct stream_transfer *stream_transfer);
|
static int stream_transfer(struct stream_transfer *stream_transfer);
|
||||||
|
@ -169,6 +164,7 @@ int plan_two_stop_voice(void)
|
||||||
|
|
||||||
int plan_two_start_bt_voice(int up_vol)
|
int plan_two_start_bt_voice(int up_vol)
|
||||||
{
|
{
|
||||||
|
(void)up_vol;
|
||||||
g_bt_upload_voice.voice_thread_run_flag = 1;
|
g_bt_upload_voice.voice_thread_run_flag = 1;
|
||||||
g_bt_download_voice.voice_thread_run_flag = 1;
|
g_bt_download_voice.voice_thread_run_flag = 1;
|
||||||
g_bt_upload_voice.voice_thread_exit_flag = 1;
|
g_bt_upload_voice.voice_thread_exit_flag = 1;
|
||||||
|
@ -253,9 +249,7 @@ int plan_two_mixer_buf(char *buf, int bytes)
|
||||||
int plan_two_start_record(void)
|
int plan_two_start_record(void)
|
||||||
{
|
{
|
||||||
int record_size=0;
|
int record_size=0;
|
||||||
char *record_buf = NULL;
|
int ret;
|
||||||
int i=0,ret;
|
|
||||||
struct list_buf *new;
|
|
||||||
|
|
||||||
memset(&(record_data), 0, sizeof(struct record_data));
|
memset(&(record_data), 0, sizeof(struct record_data));
|
||||||
|
|
||||||
|
@ -512,7 +506,6 @@ static int stream_transfer(struct stream_transfer *stream_transfer)
|
||||||
short* Drcptr;
|
short* Drcptr;
|
||||||
int size_transfer = 0;
|
int size_transfer = 0;
|
||||||
int ret =0;
|
int ret =0;
|
||||||
int exit_flag =0;
|
|
||||||
int i=0;
|
int i=0;
|
||||||
|
|
||||||
stream_sender = stream_transfer->stream_sender;
|
stream_sender = stream_transfer->stream_sender;
|
||||||
|
@ -521,7 +514,7 @@ static int stream_transfer(struct stream_transfer *stream_transfer)
|
||||||
|
|
||||||
|
|
||||||
#ifdef START_ZERO_BUFFER
|
#ifdef START_ZERO_BUFFER
|
||||||
/* 消除开头杂音 */
|
/* ??????ͷ???? */
|
||||||
memset(stream_sender->buf, 0, stream_sender->buf_size);
|
memset(stream_sender->buf, 0, stream_sender->buf_size);
|
||||||
pcm_write(stream_receiver->dev, stream_sender->buf, stream_sender->buf_size);
|
pcm_write(stream_receiver->dev, stream_sender->buf, stream_sender->buf_size);
|
||||||
#endif
|
#endif
|
||||||
|
@ -534,7 +527,7 @@ static int stream_transfer(struct stream_transfer *stream_transfer)
|
||||||
pcm_start(stream_receiver->dev);
|
pcm_start(stream_receiver->dev);
|
||||||
|
|
||||||
|
|
||||||
/* 消除开头pa音 */
|
/* ??????ͷpa?? */
|
||||||
memset(stream_sender->buf, 0, stream_sender->buf_size);
|
memset(stream_sender->buf, 0, stream_sender->buf_size);
|
||||||
pcm_write(stream_receiver->dev, stream_sender->buf, stream_sender->buf_size);
|
pcm_write(stream_receiver->dev, stream_sender->buf, stream_sender->buf_size);
|
||||||
|
|
||||||
|
@ -598,7 +591,7 @@ static int stream_transfer(struct stream_transfer *stream_transfer)
|
||||||
|
|
||||||
|
|
||||||
if (stream_transfer->record_flag == 1){
|
if (stream_transfer->record_flag == 1){
|
||||||
//是上行,还是下行.
|
//??????,????????.
|
||||||
if (stream_transfer->voice_direction == UPSTREAM){
|
if (stream_transfer->voice_direction == UPSTREAM){
|
||||||
Srcptr = (short*)(stream_sender->buf);
|
Srcptr = (short*)(stream_sender->buf);
|
||||||
Drcptr = (short*)(record_data.record_buf + (record_data.lenwriteup%record_data.record_lenth));
|
Drcptr = (short*)(record_data.record_buf + (record_data.lenwriteup%record_data.record_lenth));
|
||||||
|
|
|
@ -18,11 +18,12 @@
|
||||||
#include "plan_two.h"
|
#include "plan_two.h"
|
||||||
|
|
||||||
|
|
||||||
static bool g_is_bp_thread_running = false;
|
|
||||||
static int no_earpiece = 0;
|
static int no_earpiece = 0;
|
||||||
static bool end_call = false;
|
static bool end_call = false;
|
||||||
static int set_normal_volume(struct codec_client *client, int path, int vol)
|
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;
|
int headset_on=0, headphone_on=0, speaker_on=0;
|
||||||
|
|
||||||
headset_on = path & AUDIO_DEVICE_OUT_WIRED_HEADSET; // hp4p
|
headset_on = path & AUDIO_DEVICE_OUT_WIRED_HEADSET; // hp4p
|
||||||
|
@ -40,13 +41,12 @@ static int set_normal_volume(struct codec_client *client, int path, int vol)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool last_path_is_bt = false ;
|
|
||||||
|
|
||||||
static int set_normal_path(struct codec_client *client, int path)
|
static int set_normal_path(struct codec_client *client, int path)
|
||||||
{
|
{
|
||||||
|
(void)client;
|
||||||
int switch_to_headset =0;
|
int switch_to_headset =0;
|
||||||
int ret = -1, fd=0;
|
int ret = -1, fd=0;
|
||||||
char prop_value[20]={0};
|
|
||||||
char h2w_state[2]={0};
|
char h2w_state[2]={0};
|
||||||
int headset_on=0, headphone_on=0, speaker_on=0, earpiece_on=0,bt_button_voice=0;
|
int headset_on=0, headphone_on=0, speaker_on=0, earpiece_on=0,bt_button_voice=0;
|
||||||
|
|
||||||
|
@ -94,6 +94,8 @@ ALOGV("in normal mode,****LINE:%d,FUNC:%s",__LINE__,__FUNCTION__);
|
||||||
|
|
||||||
static int set_normal_record_enable(struct codec_client *client, bool enable)
|
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_linein_record, 0, 0);
|
||||||
//mixer_ctl_set_value(client->mixer_ctls->audio_phone_voice_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__);
|
ALOGV("normal record mode 4,****LINE:%d,FUNC:%s",__LINE__,__FUNCTION__);
|
||||||
|
@ -102,6 +104,7 @@ static int set_normal_record_enable(struct codec_client *client, bool enable)
|
||||||
|
|
||||||
static int set_normal_record(struct codec_client *client, int path)
|
static int set_normal_record(struct codec_client *client, int path)
|
||||||
{
|
{
|
||||||
|
(void)client;
|
||||||
ALOGV("normal record mode 4,****LINE:%d,FUNC:%s",__LINE__,__FUNCTION__);
|
ALOGV("normal record mode 4,****LINE:%d,FUNC:%s",__LINE__,__FUNCTION__);
|
||||||
int headset_on=0;
|
int headset_on=0;
|
||||||
headset_on = path & AUDIO_DEVICE_IN_WIRED_HEADSET;
|
headset_on = path & AUDIO_DEVICE_IN_WIRED_HEADSET;
|
||||||
|
@ -116,7 +119,9 @@ static int set_normal_record(struct codec_client *client, int path)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int set_fm_volume(struct codec_client *client, int path, int volume)
|
static int set_fm_volume(struct codec_client *client, int path, int volume)
|
||||||
{ int speaker_on=0,headset_on=0 ,headphone_on=0;
|
{
|
||||||
|
(void)client;
|
||||||
|
int speaker_on=0,headset_on=0 ,headphone_on=0;
|
||||||
int level;
|
int level;
|
||||||
|
|
||||||
headset_on = path & AUDIO_DEVICE_OUT_WIRED_HEADSET; // hp4p
|
headset_on = path & AUDIO_DEVICE_OUT_WIRED_HEADSET; // hp4p
|
||||||
|
@ -151,6 +156,7 @@ static int set_fm_volume(struct codec_client *client, int path, int volume)
|
||||||
|
|
||||||
static int set_fm_path(struct codec_client *client, int path)
|
static int set_fm_path(struct codec_client *client, int path)
|
||||||
{
|
{
|
||||||
|
(void)client;
|
||||||
int headset_on=0, headphone_on=0, speaker_on=0;
|
int headset_on=0, headphone_on=0, speaker_on=0;
|
||||||
|
|
||||||
headset_on = path & AUDIO_DEVICE_OUT_WIRED_HEADSET; // hp4p
|
headset_on = path & AUDIO_DEVICE_OUT_WIRED_HEADSET; // hp4p
|
||||||
|
@ -173,6 +179,7 @@ static int set_fm_path(struct codec_client *client, int path)
|
||||||
}
|
}
|
||||||
static int set_fm_record_enable(struct codec_client *client, bool enable)
|
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);
|
//mixer_ctl_set_value(client->mixer_ctls->audio_phone_voice_record, 0, 0);
|
||||||
|
|
||||||
if (enable){
|
if (enable){
|
||||||
|
@ -186,6 +193,8 @@ static int set_fm_record_enable(struct codec_client *client, bool enable)
|
||||||
|
|
||||||
static int set_fm_record(struct codec_client *client, int path)
|
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__);
|
ALOGV("FM record mode 4, ****LINE:%d,FUNC:%s", __LINE__,__FUNCTION__);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -193,12 +202,17 @@ static int set_fm_record(struct codec_client *client, int path)
|
||||||
|
|
||||||
static int set_factory_volume(struct codec_client *client, int path, int vol)
|
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__);
|
ALOGV("****LINE:%d,FUNC:%s",__LINE__,__FUNCTION__);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int set_factory_path(struct codec_client *client, int path)
|
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_phone_end_call, 0, 1);
|
||||||
//mixer_ctl_set_value(client->mixer_ctls->audio_linein_in, 0, 1);
|
//mixer_ctl_set_value(client->mixer_ctls->audio_linein_in, 0, 1);
|
||||||
|
|
||||||
|
@ -235,7 +249,6 @@ static int set_phone_volume(struct codec_client *client, int path, int volume)
|
||||||
{
|
{
|
||||||
int level;
|
int level;
|
||||||
int speaker_on=0,headset_on=0 ,headphone_on=0,earpiece_on=0;
|
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;
|
speaker_on = path & AUDIO_DEVICE_OUT_SPEAKER;
|
||||||
headset_on = path & AUDIO_DEVICE_OUT_WIRED_HEADSET; // with mic
|
headset_on = path & AUDIO_DEVICE_OUT_WIRED_HEADSET; // with mic
|
||||||
|
@ -281,11 +294,10 @@ 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)
|
static int clean_phone_path (struct codec_client *client)
|
||||||
{
|
{
|
||||||
|
(void)client;
|
||||||
ALOGV("***********%d,********%s********\n", __LINE__,__FUNCTION__);
|
ALOGV("***********%d,********%s********\n", __LINE__,__FUNCTION__);
|
||||||
//mixer_ctl_set_value(client->mixer_ctls->audio_phone_end_call, 0, 1);
|
//mixer_ctl_set_value(client->mixer_ctls->audio_phone_end_call, 0, 1);
|
||||||
end_call = true;
|
end_call = true;
|
||||||
|
@ -294,9 +306,8 @@ static bool bluetooth_in_record = false;
|
||||||
|
|
||||||
static int set_phone_path(struct codec_client *client, int path)
|
static int set_phone_path(struct codec_client *client, int path)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
(void)client;
|
||||||
int earpiece_on=0, headset_on=0, headphone_on=0, bt_on=0, speaker_on=0;
|
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
|
headset_on = path & AUDIO_DEVICE_OUT_WIRED_HEADSET; // hp4p
|
||||||
headphone_on = path & AUDIO_DEVICE_OUT_WIRED_HEADPHONE; // hp3p
|
headphone_on = path & AUDIO_DEVICE_OUT_WIRED_HEADPHONE; // hp3p
|
||||||
|
@ -417,7 +428,8 @@ static int set_phone_path(struct codec_client *client, int path)
|
||||||
|
|
||||||
static int set_phone_record_enable(struct codec_client *client, bool enable)
|
static int set_phone_record_enable(struct codec_client *client, bool enable)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
(void)client;
|
||||||
|
(void)enable;
|
||||||
#if 0
|
#if 0
|
||||||
mixer_ctl_set_value(client->mixer_ctls->audio_linein_record, 0, 0);
|
mixer_ctl_set_value(client->mixer_ctls->audio_linein_record, 0, 0);
|
||||||
|
|
||||||
|
@ -437,12 +449,15 @@ static int set_phone_record_enable(struct codec_client *client, bool enable)
|
||||||
|
|
||||||
static int set_phone_record(struct codec_client *client, int path)
|
static int set_phone_record(struct codec_client *client, int path)
|
||||||
{
|
{
|
||||||
|
(void)client;
|
||||||
|
(void)path;
|
||||||
ALOGV("****LINE:%d,FUNC:%s",__LINE__,__FUNCTION__);
|
ALOGV("****LINE:%d,FUNC:%s",__LINE__,__FUNCTION__);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int record_read_pcm_buf(struct codec_client *client, void* buffer, int bytes)
|
static int record_read_pcm_buf(struct codec_client *client, void* buffer, int bytes)
|
||||||
{
|
{
|
||||||
|
(void)client;
|
||||||
ALOGV("1****LINE:%d,FUNC:%s",__LINE__,__FUNCTION__);
|
ALOGV("1****LINE:%d,FUNC:%s",__LINE__,__FUNCTION__);
|
||||||
|
|
||||||
return plan_two_mixer_buf(buffer, bytes);
|
return plan_two_mixer_buf(buffer, bytes);
|
||||||
|
|
|
@ -204,7 +204,6 @@ static volatile long int g_total_size = 0;
|
||||||
|
|
||||||
static void *record_manage_thread(void *param)
|
static void *record_manage_thread(void *param)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
|
||||||
struct record_private *record = (struct record_private*)param;
|
struct record_private *record = (struct record_private*)param;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,6 @@
|
||||||
#define KEY_PHONEPN_GAIN "phonepn_gain"
|
#define KEY_PHONEPN_GAIN "phonepn_gain"
|
||||||
|
|
||||||
static void free_int_list(int *p);
|
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 int *process_line(FILE *fp, int *ret_len);
|
||||||
|
|
||||||
static void free_int_list(int *p)
|
static void free_int_list(int *p)
|
||||||
|
@ -44,14 +43,6 @@ 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)
|
static int * process_line(FILE *fp, int *ret_len)
|
||||||
{
|
{
|
||||||
char linebuf[MAX_LINE_SZ];
|
char linebuf[MAX_LINE_SZ];
|
||||||
|
@ -101,7 +92,7 @@ static int * process_line(FILE *fp, int *ret_len)
|
||||||
int get_volume_config(struct volume_array *vol_array)
|
int get_volume_config(struct volume_array *vol_array)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char *key_name, *key_value;
|
char *key_name;
|
||||||
char linebuf[MAX_LINE_SZ];
|
char linebuf[MAX_LINE_SZ];
|
||||||
char *line;
|
char *line;
|
||||||
int *val_array=NULL;
|
int *val_array=NULL;
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
#define AT_PATH "/dev/mux2"
|
#define AT_PATH "/dev/mux2"
|
||||||
|
|
||||||
|
|
||||||
//获得bp设备节点.
|
//????bp?豸?ڵ?.
|
||||||
static int demo_get_tty_dev(char *name)
|
static int demo_get_tty_dev(char *name)
|
||||||
{
|
{
|
||||||
strncpy(name, AT_PATH, strlen(AT_PATH));
|
strncpy(name, AT_PATH, strlen(AT_PATH));
|
||||||
|
@ -22,20 +22,14 @@ static int demo_get_tty_dev(char *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//声音数组.分6级,顺序依次从第1级到第六级
|
//????????.?֣???,˳???<3F><>δӵڣ???????????
|
||||||
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)
|
static int demo_set_call_volume(ril_audio_path_type_t path, int volume)
|
||||||
{
|
{
|
||||||
|
(void)path;
|
||||||
char tty_dev[32]={0};
|
char tty_dev[32]={0};
|
||||||
char cmdline[30];
|
int level;
|
||||||
int level, bp_vol;
|
|
||||||
|
|
||||||
|
|
||||||
if (volume >= 10) {
|
if (volume >= 10) {
|
||||||
|
@ -84,11 +78,10 @@ static int demo_set_call_volume(ril_audio_path_type_t path, int volume)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//路径切换调用
|
//·???л?????
|
||||||
static int demo_set_call_path(ril_audio_path_type_t path)
|
static int demo_set_call_path(ril_audio_path_type_t path)
|
||||||
{
|
{
|
||||||
int channel = 0;
|
(void)path;
|
||||||
char cmdline[50]={0};
|
|
||||||
char tty_dev[32]={0};
|
char tty_dev[32]={0};
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -150,10 +143,10 @@ static int demo_set_call_path(ril_audio_path_type_t path)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//调用任意at指令
|
//????????atָ??
|
||||||
static int demo_set_call_at(char *at)
|
static int demo_set_call_at(char *at)
|
||||||
{
|
{
|
||||||
char tty_dev[32]={0};
|
(void)at;
|
||||||
|
|
||||||
// demo_get_tty_dev(tty_dev);
|
// demo_get_tty_dev(tty_dev);
|
||||||
//1 exec_at(tty_dev,at);
|
//1 exec_at(tty_dev,at);
|
||||||
|
|
|
@ -48,6 +48,7 @@ static int mu509_get_tty_dev(char *name)
|
||||||
|
|
||||||
static int mu509_set_call_volume(ril_audio_path_type_t path, int volume)
|
static int mu509_set_call_volume(ril_audio_path_type_t path, int volume)
|
||||||
{
|
{
|
||||||
|
(void)path;
|
||||||
char tty_dev[32]={0};
|
char tty_dev[32]={0};
|
||||||
char cmdline[30];
|
char cmdline[30];
|
||||||
|
|
||||||
|
@ -79,7 +80,6 @@ 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)
|
static int mu509_set_call_path(ril_audio_path_type_t path)
|
||||||
{
|
{
|
||||||
int channel = 0;
|
int channel = 0;
|
||||||
int audio_loop_en = 1;
|
|
||||||
char cmdline[50]={0};
|
char cmdline[50]={0};
|
||||||
char tty_dev[32]={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);
|
sprintf(cmdline, "AT^SWSPATH=%d", channel);
|
||||||
exec_at(tty_dev,cmdline);
|
exec_at(tty_dev,cmdline);
|
||||||
ALOGD("channel, cmdline:%s,cmdline:%d", cmdline, cmdline);
|
ALOGD("channel, cmdline:%s,cmdline:%s", cmdline, cmdline);
|
||||||
// sprintf(cmdline, "AT^ECHO=%d", audio_loop_en);
|
// sprintf(cmdline, "AT^ECHO=%d", audio_loop_en);
|
||||||
// ALOGD("audio_loop_en- add sound loop cancel, cmdline:%s,cmdline:%d", cmdline, cmdline);
|
// ALOGD("audio_loop_en- add sound loop cancel, cmdline:%s,cmdline:%d", cmdline, cmdline);
|
||||||
// exec_at(tty_dev,cmdline);
|
// exec_at(tty_dev,cmdline);
|
||||||
|
|
|
@ -16,18 +16,22 @@ static char tty_dev[32] = AT_PATH;
|
||||||
|
|
||||||
static int em55_get_tty_dev(char *name)
|
static int em55_get_tty_dev(char *name)
|
||||||
{
|
{
|
||||||
|
(void)name;
|
||||||
ALOGD("em55_get_tty_dev\n");
|
ALOGD("em55_get_tty_dev\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int em55_set_call_volume(ril_audio_path_type_t path, int vol)
|
static int em55_set_call_volume(ril_audio_path_type_t path, int vol)
|
||||||
{
|
{
|
||||||
|
(void)path;
|
||||||
|
(void)vol;
|
||||||
ALOGD("em55_set_call_volume\n");
|
ALOGD("em55_set_call_volume\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int em55_set_call_path(ril_audio_path_type_t path)
|
static int em55_set_call_path(ril_audio_path_type_t path)
|
||||||
{
|
{
|
||||||
|
(void)path;
|
||||||
ALOGD("em55_set_call_path\n");
|
ALOGD("em55_set_call_path\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
#define AT_PATH "/dev/ttyS3"
|
#define AT_PATH "/dev/ttyS3"
|
||||||
|
|
||||||
|
|
||||||
//获得bp设备节点.
|
//????bp?豸?ڵ?.
|
||||||
static int usi6276_get_tty_dev(char *name)
|
static int usi6276_get_tty_dev(char *name)
|
||||||
{
|
{
|
||||||
strncpy(name, AT_PATH, strlen(AT_PATH));
|
strncpy(name, AT_PATH, strlen(AT_PATH));
|
||||||
|
@ -22,20 +22,14 @@ static int usi6276_get_tty_dev(char *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//声音数组.分6级,顺序依次从第1级到第六级
|
//????????.?֣???,˳???<3F><>δӵڣ???????????
|
||||||
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)
|
static int usi6276_set_call_volume(ril_audio_path_type_t path, int volume)
|
||||||
{
|
{
|
||||||
|
(void)path;
|
||||||
char tty_dev[32]={0};
|
char tty_dev[32]={0};
|
||||||
char cmdline[30];
|
int level;
|
||||||
int level, bp_vol;
|
|
||||||
|
|
||||||
|
|
||||||
if (volume >= 10) {
|
if (volume >= 10) {
|
||||||
|
@ -84,11 +78,10 @@ static int usi6276_set_call_volume(ril_audio_path_type_t path, int volume)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//路径切换调用
|
//·???л?????
|
||||||
static int usi6276_set_call_path(ril_audio_path_type_t path)
|
static int usi6276_set_call_path(ril_audio_path_type_t path)
|
||||||
{
|
{
|
||||||
int channel = 0;
|
(void)path;
|
||||||
char cmdline[50]={0};
|
|
||||||
char tty_dev[32]={0};
|
char tty_dev[32]={0};
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -150,7 +143,7 @@ static int usi6276_set_call_path(ril_audio_path_type_t path)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//调用任意at指令
|
//????????atָ??
|
||||||
static int usi6276_set_call_at(char *at)
|
static int usi6276_set_call_at(char *at)
|
||||||
{
|
{
|
||||||
char tty_dev[32]={0};
|
char tty_dev[32]={0};
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
#define KEY_PHONEPN_GAIN "phonepn_gain"
|
#define KEY_PHONEPN_GAIN "phonepn_gain"
|
||||||
|
|
||||||
static void free_int_list(int *p);
|
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 int *process_line(FILE *fp, int *ret_len);
|
||||||
|
|
||||||
static void free_int_list(int *p)
|
static void free_int_list(int *p)
|
||||||
|
@ -43,7 +43,7 @@ static void free_int_list(int *p)
|
||||||
free(p);
|
free(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#if 0
|
||||||
void print_array(int *array, int array_size)
|
void print_array(int *array, int array_size)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
@ -51,7 +51,7 @@ void print_array(int *array, int array_size)
|
||||||
ALOGD("array[%d]=%d", i, array[i]);
|
ALOGD("array[%d]=%d", i, array[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
static int * process_line(FILE *fp, int *ret_len)
|
static int * process_line(FILE *fp, int *ret_len)
|
||||||
{
|
{
|
||||||
char linebuf[MAX_LINE_SZ];
|
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)
|
int get_volume_config(struct volume_array *vol_array)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char *key_name, *key_value;
|
char *key_name;
|
||||||
char linebuf[MAX_LINE_SZ];
|
char linebuf[MAX_LINE_SZ];
|
||||||
char *line;
|
char *line;
|
||||||
int *val_array=NULL;
|
int *val_array=NULL;
|
||||||
|
@ -284,9 +284,10 @@ int codec_voice_volume_init(struct volume_array *vol_array)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void phone_volume_config(struct sunxi_audio_device *adev, int volume)
|
void phone_volume_config(void *adev, int volume)
|
||||||
{
|
{
|
||||||
|
(void)adev;
|
||||||
|
(void)volume;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -49,5 +49,5 @@ LOCAL_C_INCLUDES +=system/core/include/ \
|
||||||
LOCAL_MODULE := hwcomposer.tulip
|
LOCAL_MODULE := hwcomposer.tulip
|
||||||
LOCAL_CFLAGS:= -DLOG_TAG=\"hwcomposer\"
|
LOCAL_CFLAGS:= -DLOG_TAG=\"hwcomposer\"
|
||||||
LOCAL_MODULE_TAGS := optional
|
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)
|
include $(BUILD_SHARED_LIBRARY)
|
||||||
|
|
|
@ -19,27 +19,26 @@
|
||||||
#include "cutils/properties.h"
|
#include "cutils/properties.h"
|
||||||
|
|
||||||
|
|
||||||
static int Framecount = 0;
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static int hwc_device_open(const struct hw_module_t* module, const char* name,
|
static int hwc_device_open(const struct hw_module_t* module, const char* name,
|
||||||
struct hw_device_t** device);
|
struct hw_device_t** device);
|
||||||
|
|
||||||
static struct hw_module_methods_t hwc_module_methods = {
|
static struct hw_module_methods_t hwc_module_methods = {
|
||||||
open: hwc_device_open
|
.open = hwc_device_open
|
||||||
};
|
};
|
||||||
|
|
||||||
hwc_module_t HAL_MODULE_INFO_SYM = {
|
hwc_module_t HAL_MODULE_INFO_SYM = {
|
||||||
common: {
|
.common = {
|
||||||
tag: HARDWARE_MODULE_TAG,
|
.tag = HARDWARE_MODULE_TAG,
|
||||||
version_major: 1,
|
.version_major = 1,
|
||||||
version_minor: 0,
|
.version_minor = 0,
|
||||||
id: HWC_HARDWARE_MODULE_ID,
|
.id = HWC_HARDWARE_MODULE_ID,
|
||||||
name: "Sunxi hwcomposer module",
|
.name = "Sunxi hwcomposer module",
|
||||||
author: "Allwinner Tech",
|
.author = "Allwinner Tech",
|
||||||
methods: &hwc_module_methods,
|
.methods = &hwc_module_methods,
|
||||||
dso: 0,
|
.dso = 0,
|
||||||
reserved: {0},
|
.reserved = {0},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -47,6 +46,7 @@ hwc_module_t HAL_MODULE_INFO_SYM = {
|
||||||
|
|
||||||
int hwc_get_density(int width, int height)
|
int hwc_get_density(int width, int height)
|
||||||
{
|
{
|
||||||
|
(void)width;
|
||||||
char name[100];
|
char name[100];
|
||||||
char value[PROPERTY_VALUE_MAX];
|
char value[PROPERTY_VALUE_MAX];
|
||||||
sprintf(name, "ro.sf.lcd_density.%d", height);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
static int hwc_setParameter(struct hwc_composer_device_1* dev, int cmd, int disp,
|
static int hwc_setParameter(struct hwc_composer_device_1* dev, int cmd, int disp,
|
||||||
int para0, int para1)
|
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);
|
HWC_UNREFERENCED_PARAMETER(para1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
static
|
static
|
||||||
|
@ -312,8 +312,8 @@ static int hwc_device_open(const struct hw_module_t* module, const char* name,
|
||||||
|
|
||||||
psHwcDevice->prepare = hwc_prepare;
|
psHwcDevice->prepare = hwc_prepare;
|
||||||
psHwcDevice->set = hwc_set;
|
psHwcDevice->set = hwc_set;
|
||||||
psHwcDevice->setParameter = hwc_setParameter;
|
//psHwcDevice->setParameter = hwc_setParameter;
|
||||||
psHwcDevice->getParameter = hwc_getParameter;
|
//psHwcDevice->getParameter = hwc_getParameter;
|
||||||
psHwcDevice->registerProcs = hwc_register_procs;
|
psHwcDevice->registerProcs = hwc_register_procs;
|
||||||
psHwcDevice->eventControl = hwc_eventControl;
|
psHwcDevice->eventControl = hwc_eventControl;
|
||||||
psHwcDevice->blank = hwc_blank;
|
psHwcDevice->blank = hwc_blank;
|
||||||
|
|
|
@ -4,11 +4,11 @@
|
||||||
#include <hardware/hardware.h>
|
#include <hardware/hardware.h>
|
||||||
#include <hardware/hwcomposer.h>
|
#include <hardware/hwcomposer.h>
|
||||||
|
|
||||||
#include <hardware/hal_public.h>
|
//#include <hal_public.h>
|
||||||
#include "sunxi_display2.h"
|
#include "sunxi_display2.h"
|
||||||
#include "sunxi_tr.h"
|
#include "sunxi_tr.h"
|
||||||
//#include "gralloc_priv.h"
|
#include "gralloc_priv.h"
|
||||||
//#include "fb.h"
|
#include <linux/fb.h>
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
@ -310,6 +310,26 @@ typedef struct ChannelInfo{
|
||||||
layer_info_t *HwLayer[NUMLAYEROFCHANNEL];
|
layer_info_t *HwLayer[NUMLAYEROFCHANNEL];
|
||||||
} ChannelInfo_t;
|
} 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{
|
typedef struct{
|
||||||
int VirtualToHWDisplay;
|
int VirtualToHWDisplay;
|
||||||
bool VsyncEnable;
|
bool VsyncEnable;
|
||||||
|
@ -597,7 +617,7 @@ static inline bool check_cursor(hwc_layer_1_t *layer, int order, int count)
|
||||||
struct private_handle_t *handle = (struct private_handle_t *)layer->handle;
|
struct private_handle_t *handle = (struct private_handle_t *)layer->handle;
|
||||||
return (layer->flags & HWC_IS_CURSOR_LAYER)
|
return (layer->flags & HWC_IS_CURSOR_LAYER)
|
||||||
&& (count-order == 2)
|
&& (count-order == 2)
|
||||||
&& check_cursor_format(handle->format);
|
&& check_cursor_format(handle->iFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int check_valid_format(int format)
|
static inline int check_valid_format(int format)
|
||||||
|
@ -668,7 +688,7 @@ bool static inline check_3d_video(const DisplayInfo *PsDisplayInfo, hwc_layer_1_
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if(!check_video(handle->format))
|
if(!check_video(handle->iFormat))
|
||||||
{
|
{
|
||||||
goto no_3d;
|
goto no_3d;
|
||||||
}
|
}
|
||||||
|
@ -738,7 +758,7 @@ static bool inline check_same_scale(float SRWscaleFac, float SRHscaleFac,
|
||||||
|
|
||||||
bool inline hwc_rotate_mem(SUNXI_hwcdev_context_t *Globctx, struct private_handle_t *handle)
|
bool inline hwc_rotate_mem(SUNXI_hwcdev_context_t *Globctx, struct private_handle_t *handle)
|
||||||
{
|
{
|
||||||
if((Globctx->has_tr_mem + handle->width * handle->height) > Globctx->tr_mem_limit)
|
if((Globctx->has_tr_mem + handle->iWidth * handle->iHeight) > Globctx->tr_mem_limit)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,6 @@ 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)
|
hwc_dispc_data_t* hwc_layer_cache_get(SUNXI_hwcdev_context_t *Globctx, int countdisp)
|
||||||
{
|
{
|
||||||
int i = 0, cout_cut = 2;
|
int i = 0, cout_cut = 2;
|
||||||
bool fix = 0;
|
|
||||||
list_head_t *head_pos = NULL;
|
list_head_t *head_pos = NULL;
|
||||||
list_head_t *head_bak = NULL;
|
list_head_t *head_bak = NULL;
|
||||||
hwc_dispc_data_t *manage_cache = NULL;
|
hwc_dispc_data_t *manage_cache = NULL;
|
||||||
|
@ -207,11 +206,10 @@ void hwc_manage_layer_cache(SUNXI_hwcdev_context_t *Globctx, hwc_dispc_data_t *c
|
||||||
{
|
{
|
||||||
list_head_t *reference_commit = NULL;
|
list_head_t *reference_commit = NULL;
|
||||||
list_head_t *head_pos = NULL;
|
list_head_t *head_pos = NULL;
|
||||||
list_head_t *head_bak = NULL;
|
|
||||||
hwc_dispc_data_t *manage_cache = NULL;
|
hwc_dispc_data_t *manage_cache = NULL;
|
||||||
hwc_dispc_data_t *reference_cache = NULL;
|
hwc_dispc_data_t *reference_cache = NULL;
|
||||||
long offset = 0;
|
long offset = 0;
|
||||||
int i = 0, j = 0;
|
int i = 0;
|
||||||
offset = container_of(hwc_dispc_data_t, manage_head);
|
offset = container_of(hwc_dispc_data_t, manage_head);
|
||||||
|
|
||||||
if(commit_head != NULL)
|
if(commit_head != NULL)
|
||||||
|
@ -334,13 +332,12 @@ void *commit_thread(void *priv)
|
||||||
list_head_t *CommitList = NULL;
|
list_head_t *CommitList = NULL;
|
||||||
hwc_dispc_data_t *DisplayData = NULL;
|
hwc_dispc_data_t *DisplayData = NULL;
|
||||||
int i = 0, j = 0, ret = -1, lyr = 0, rotatecall = 0;
|
int i = 0, j = 0, ret = -1, lyr = 0, rotatecall = 0;
|
||||||
int primary_disp = 0, tr_fence_fd = -1, share_fd = -1, release_rotate = 0, has_tr = 0;
|
int primary_disp = 0, tr_fence_fd = -1, share_fd = -1, has_tr = 0;
|
||||||
unsigned long arg[4] = {0};
|
unsigned long arg[4] = {0};
|
||||||
unsigned int current_sync_count = 0, cusor_sync = 0;
|
unsigned int current_sync_count = 0, cusor_sync = 0;
|
||||||
hwc_ioctl_arg hwc_cmd;
|
hwc_ioctl_arg hwc_cmd;
|
||||||
hwc_cmd.cmd = HWC_IOCTL_COMMIT;
|
hwc_cmd.cmd = HWC_IOCTL_COMMIT;
|
||||||
hwc_commit_data_t commit_data;
|
hwc_commit_data_t commit_data;
|
||||||
disp_capture_info wb_data;
|
|
||||||
hwc_commit_layer_t cursor_layer[NUMBEROFDISPLAY];
|
hwc_commit_layer_t cursor_layer[NUMBEROFDISPLAY];
|
||||||
bool need_sync = 0, pause = 0;
|
bool need_sync = 0, pause = 0;
|
||||||
int continues_stop = 0;
|
int continues_stop = 0;
|
||||||
|
@ -353,7 +350,6 @@ void *commit_thread(void *priv)
|
||||||
double starttime = 0.0;
|
double starttime = 0.0;
|
||||||
gettimeofday(&tv, NULL);
|
gettimeofday(&tv, NULL);
|
||||||
starttime = tv.tv_sec * 1000 + tv.tv_usec / 1.0e3;
|
starttime = tv.tv_sec * 1000 + tv.tv_usec / 1.0e3;
|
||||||
double fCurrentTime = 0.0;
|
|
||||||
//fiix
|
//fiix
|
||||||
memset(cursor_layer, 0, sizeof(hwc_commit_layer_t) * NUMBEROFDISPLAY);
|
memset(cursor_layer, 0, sizeof(hwc_commit_layer_t) * NUMBEROFDISPLAY);
|
||||||
setpriority(PRIO_PROCESS, 0, HAL_PRIORITY_URGENT_DISPLAY);
|
setpriority(PRIO_PROCESS, 0, HAL_PRIORITY_URGENT_DISPLAY);
|
||||||
|
|
|
@ -297,7 +297,6 @@ void hwc_cursor_manage(SUNXI_hwcdev_context_t *Globctx,
|
||||||
int i = 0, disp = -1;
|
int i = 0, disp = -1;
|
||||||
DisplayInfo *cursor_disp = NULL;
|
DisplayInfo *cursor_disp = NULL;
|
||||||
hwc_cursor_async_t *set_cursor = NULL;
|
hwc_cursor_async_t *set_cursor = NULL;
|
||||||
bool has_cursor = 0;
|
|
||||||
|
|
||||||
for(i = 0; i < Globctx->NumberofDisp; i++)
|
for(i = 0; i < Globctx->NumberofDisp; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -105,7 +105,7 @@ void show_displays(HwcDisContext_t *Localctx)
|
||||||
,Localctx->ChannelInfo[1].memthruput
|
,Localctx->ChannelInfo[1].memthruput
|
||||||
,Localctx->ChannelInfo[2].memthruput
|
,Localctx->ChannelInfo[2].memthruput
|
||||||
,Localctx->ChannelInfo[3].memthruput
|
,Localctx->ChannelInfo[3].memthruput
|
||||||
,PsDisplayInfo->mytimestamp);
|
,(long long)PsDisplayInfo->mytimestamp);
|
||||||
|
|
||||||
ALOGD("+---------+--+---+---+-----+--+---+--------------+--------+--------+--------+--------+--------+--------+--------+--------+--------+----------+");
|
ALOGD("+---------+--+---+---+-----+--+---+--------------+--------+--------+--------+--------+--------+--------+--------+--------+--------+----------+");
|
||||||
ALOGD("+\n"
|
ALOGD("+\n"
|
||||||
|
@ -132,14 +132,14 @@ void show_displays(HwcDisContext_t *Localctx)
|
||||||
sunxiLayers->virchannel >= 0 ?
|
sunxiLayers->virchannel >= 0 ?
|
||||||
Localctx->ChannelInfo[sunxiLayers->virchannel].planeAlpha : 0xff,
|
Localctx->ChannelInfo[sunxiLayers->virchannel].planeAlpha : 0xff,
|
||||||
sunxiLayers->need_sync,
|
sunxiLayers->need_sync,
|
||||||
l->handle,
|
(unsigned int)((unsigned long)l->handle),
|
||||||
handle == 0 ? 0 :
|
handle == 0 ? 0 :
|
||||||
((handle->flags & private_handle_t::PRIV_FLAGS_USES_CONFIG) ? ion_get_addr_fromfd(handle->share_fd):0),
|
((handle->flags & private_handle_t::PRIV_FLAGS_USES_ION) ? ion_get_addr_fromfd(handle->share_fd):0),
|
||||||
handle == 0 ? 0 : handle->usage,
|
handle == 0 ? 0 : handle->usage,
|
||||||
l->flags,
|
l->flags,
|
||||||
l->transform,
|
l->transform,
|
||||||
l->blending,
|
l->blending,
|
||||||
handle==0?0:handle->format,
|
handle==0?0:handle->iFormat,
|
||||||
#if !defined(HWC_1_3)
|
#if !defined(HWC_1_3)
|
||||||
l->sourceCrop.left,
|
l->sourceCrop.left,
|
||||||
l->sourceCrop.top,
|
l->sourceCrop.top,
|
||||||
|
@ -270,7 +270,6 @@ void hwc_debug_close_layer(SUNXI_hwcdev_context_t *psCtx, hwc_commit_data_t *com
|
||||||
if(psCtx->hwcdebug && psCtx->close_layer)
|
if(psCtx->hwcdebug && psCtx->close_layer)
|
||||||
{
|
{
|
||||||
disp_layer_config *fix_layer = NULL;
|
disp_layer_config *fix_layer = NULL;
|
||||||
hwc_commit_layer_t *hwc_layer_info = NULL;
|
|
||||||
int lyr = -1;
|
int lyr = -1;
|
||||||
char property[PROPERTY_VALUE_MAX];
|
char property[PROPERTY_VALUE_MAX];
|
||||||
char *ps_fix = property;
|
char *ps_fix = property;
|
||||||
|
@ -445,7 +444,7 @@ void hwc_debug_dump_layer(SUNXI_hwcdev_context_t *psCtx,
|
||||||
ret = ::write(fd, addr_0, size);
|
ret = ::write(fd, addr_0, size);
|
||||||
if(ret != size)
|
if(ret != size)
|
||||||
{
|
{
|
||||||
ALOGD("write %s err %d", ret, dump_src);
|
ALOGD("write %d err %s", ret, dump_src);
|
||||||
}
|
}
|
||||||
munmap(addr_0,size);
|
munmap(addr_0,size);
|
||||||
close(fd);
|
close(fd);
|
||||||
|
@ -464,7 +463,6 @@ bool hwc_debug_pause(SUNXI_hwcdev_context_t *psCtx, int sync_count, bool paused)
|
||||||
char *ps_fix = property;
|
char *ps_fix = property;
|
||||||
if (property_get("debug.hwc.showfps", property, NULL) >= 0)
|
if (property_get("debug.hwc.showfps", property, NULL) >= 0)
|
||||||
{
|
{
|
||||||
bool change = 0;
|
|
||||||
if(!hwc_cmp("set", ps_fix))
|
if(!hwc_cmp("set", ps_fix))
|
||||||
{
|
{
|
||||||
ALOGD("###Pause at frame:%d ###", sync_count-1);
|
ALOGD("###Pause at frame:%d ###", sync_count-1);
|
||||||
|
|
|
@ -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)
|
bool hwc_manage_ref_cache(bool cache, hwc_dispc_data_t *dispc_data)
|
||||||
{
|
{
|
||||||
hwc_ion_hold_t *ion_cache = NULL;
|
hwc_ion_hold_t *ion_cache = NULL;
|
||||||
int i, little_sync, cnt = 0, size = 0;
|
int i, cnt = 0, size = 0;
|
||||||
hwc_commit_layer_t *commit_layer = NULL;
|
hwc_commit_layer_t *commit_layer = NULL;
|
||||||
int *_array = NULL;
|
int *_array = NULL;
|
||||||
|
|
||||||
|
|
|
@ -21,14 +21,12 @@ AssignDUETO_T calculate_memthruput(HwcDisContext_t *Localctx, layer_info_t *hwLa
|
||||||
int memoflayer = 0, whilecnt = 0, fb_mem = 0, need_mem = 0;
|
int memoflayer = 0, whilecnt = 0, fb_mem = 0, need_mem = 0;
|
||||||
SUNXI_hwcdev_context_t *Globctx = &gSunxiHwcDevice;
|
SUNXI_hwcdev_context_t *Globctx = &gSunxiHwcDevice;
|
||||||
hwc_layer_1_t *psLayer = hwLayer->psLayer;
|
hwc_layer_1_t *psLayer = hwLayer->psLayer;
|
||||||
struct private_handle_t *handle = (struct private_handle_t*)psLayer->handle;
|
|
||||||
ChannelInfo_t *channelinfo;
|
ChannelInfo_t *channelinfo;
|
||||||
hwc_rect_t rectx = {0,0,0,0};
|
hwc_rect_t rectx = {0,0,0,0};
|
||||||
hwc_rect_t rectx2 = {0,0,0,0};
|
hwc_rect_t rectx2 = {0,0,0,0};
|
||||||
hwc_rect_t *psdiplay = &psLayer->displayFrame;
|
hwc_rect_t *psdiplay = &psLayer->displayFrame;
|
||||||
int prememvideo;
|
int prememvideo;
|
||||||
prememvideo = Localctx->prememvideo;
|
prememvideo = Localctx->prememvideo;
|
||||||
bool re_cal_mem = 1;
|
|
||||||
|
|
||||||
channelinfo = &Localctx->ChannelInfo[channel];
|
channelinfo = &Localctx->ChannelInfo[channel];
|
||||||
if(check_swap_w_h(psLayer->transform))
|
if(check_swap_w_h(psLayer->transform))
|
||||||
|
@ -110,7 +108,6 @@ AssignDUETO_T calculate_memthruput(HwcDisContext_t *Localctx, layer_info_t *hwLa
|
||||||
fb_mem = Localctx->cur_fb_thruput;
|
fb_mem = Localctx->cur_fb_thruput;
|
||||||
}
|
}
|
||||||
|
|
||||||
cal_mem:
|
|
||||||
need_mem = Globctx->currentmem + memoflayer + prememvideo + fb_mem
|
need_mem = Globctx->currentmem + memoflayer + prememvideo + fb_mem
|
||||||
+ Globctx->fb_pre_mem - Globctx->memlimit;
|
+ Globctx->fb_pre_mem - Globctx->memlimit;
|
||||||
if(need_mem <= 0)
|
if(need_mem <= 0)
|
||||||
|
@ -130,7 +127,6 @@ cal_mem:
|
||||||
}else{
|
}else{
|
||||||
goto overflow;
|
goto overflow;
|
||||||
}
|
}
|
||||||
fix_mem:
|
|
||||||
Localctx->cur_de_thruput += memoflayer;
|
Localctx->cur_de_thruput += memoflayer;
|
||||||
channelinfo->memthruput += memoflayer;
|
channelinfo->memthruput += memoflayer;
|
||||||
Globctx->currentmem += memoflayer;
|
Globctx->currentmem += memoflayer;
|
||||||
|
@ -252,9 +248,7 @@ 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
|
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;
|
diff_sync_count = DisplayData->sync_count - start_count;
|
||||||
i = 0;
|
i = 0;
|
||||||
static int mem_all_diff = 0, setup_cnt = 0, de_mem_all = 0;
|
static int de_mem_all = 0;
|
||||||
int lower_max_mem = 0, mem_setup = 0;
|
|
||||||
bool dvfs_start = 0;
|
|
||||||
while(i < NUMBEROFDISPLAY)
|
while(i < NUMBEROFDISPLAY)
|
||||||
{
|
{
|
||||||
local_mem[i] = DisplayData->local_mem[i];
|
local_mem[i] = DisplayData->local_mem[i];
|
||||||
|
@ -351,7 +345,6 @@ bool mem_ctrl_power_policy(SUNXI_hwcdev_context_t *Globctx, HwcDisContext_t *loc
|
||||||
goto gpu_composite;
|
goto gpu_composite;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
de_composite:
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
gpu_composite:
|
gpu_composite:
|
||||||
|
|
|
@ -21,7 +21,6 @@ static int _hwc_device_set_3d_mode_per_display(int disp, __display_3d_mode new_m
|
||||||
DisplayInfo *PsDisplayInfo = &Globctx->SunxiDisplay[disp];
|
DisplayInfo *PsDisplayInfo = &Globctx->SunxiDisplay[disp];
|
||||||
__display_3d_mode old_mode = PsDisplayInfo->Current3DMode;
|
__display_3d_mode old_mode = PsDisplayInfo->Current3DMode;
|
||||||
static int last2dMode;
|
static int last2dMode;
|
||||||
unsigned long arg[4]={0};
|
|
||||||
disp_tv_mode current_mode;
|
disp_tv_mode current_mode;
|
||||||
if(old_mode == new_mode)
|
if(old_mode == new_mode)
|
||||||
{
|
{
|
||||||
|
|
|
@ -179,6 +179,7 @@ static hwc_cache_t *hwc_tr_cache_get(rotate_cache_t *rotate_cache, int size, int
|
||||||
tr_cache->share_fd = -1;
|
tr_cache->share_fd = -1;
|
||||||
tr_cache->size_buffer = 0;
|
tr_cache->size_buffer = 0;
|
||||||
}
|
}
|
||||||
|
#define ION_HEAP_SECURE_MASK 1
|
||||||
if(tr_cache->share_fd == -1 || tr_cache->size_buffer == 0)
|
if(tr_cache->share_fd == -1 || tr_cache->size_buffer == 0)
|
||||||
{
|
{
|
||||||
if(is_secure){
|
if(is_secure){
|
||||||
|
@ -221,7 +222,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)
|
static hwc_cache_t *hwc_cache_get_last(rotate_cache_t *rotate_cache, unsigned int sync_count)
|
||||||
{
|
{
|
||||||
hwc_cache_t *tr_cache = NULL;
|
hwc_cache_t *tr_cache = NULL;
|
||||||
int i = 0, biggest = -1, ret = -1;
|
int i = 0, biggest = -1;
|
||||||
unsigned int big_sync = 0;
|
unsigned int big_sync = 0;
|
||||||
|
|
||||||
for(i = 0; i < ROTATE_CACHE_COUNT; i++)
|
for(i = 0; i < ROTATE_CACHE_COUNT; i++)
|
||||||
|
@ -251,7 +252,7 @@ void hwc_rotate_cache_free(void)
|
||||||
SUNXI_hwcdev_context_t *Globctx = &gSunxiHwcDevice;
|
SUNXI_hwcdev_context_t *Globctx = &gSunxiHwcDevice;
|
||||||
hwc_cache_t *tr_cache = NULL;
|
hwc_cache_t *tr_cache = NULL;
|
||||||
rotate_cache_t *rotate_cache = NULL;
|
rotate_cache_t *rotate_cache = NULL;
|
||||||
int i = 0, j = 0;
|
int i = 0;
|
||||||
list_head_t *head = NULL;
|
list_head_t *head = NULL;
|
||||||
ALOGD("hwc_rotate_cache_free[%d]",Globctx->rotate_hold_cnt);
|
ALOGD("hwc_rotate_cache_free[%d]",Globctx->rotate_hold_cnt);
|
||||||
while(NULL != (head = hwc_list_get(&Globctx->rotate_cache_list)))
|
while(NULL != (head = hwc_list_get(&Globctx->rotate_cache_list)))
|
||||||
|
@ -501,23 +502,17 @@ void hwc_resize_crop(disp_fb_info *hw_layer, int w_original, int h_original, tr_
|
||||||
{
|
{
|
||||||
case TR_HFLIP:
|
case TR_HFLIP:
|
||||||
w_diff = hw_layer->size[0].width - w_original;
|
w_diff = hw_layer->size[0].width - w_original;
|
||||||
hw_layer->crop.x + (long long)(((long long)w_diff)<<32);
|
|
||||||
break;
|
break;
|
||||||
case TR_VFLIP:
|
case TR_VFLIP:
|
||||||
h_diff = hw_layer->size[0].height - h_original;
|
h_diff = hw_layer->size[0].height - h_original;
|
||||||
hw_layer->crop.y + (long long)(((long long)h_diff)<<32);
|
|
||||||
break;
|
break;
|
||||||
case TR_ROT_90:
|
case TR_ROT_90:
|
||||||
w_diff = hw_layer->size[0].width - h_original;
|
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;
|
h_diff = hw_layer->size[0].height - w_original;
|
||||||
hw_layer->crop.y + (long long)(((long long)h_diff)<<32);
|
|
||||||
break;
|
break;
|
||||||
case TR_ROT_180:
|
case TR_ROT_180:
|
||||||
h_diff = hw_layer->size[0].height - h_original;
|
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;
|
w_diff = hw_layer->size[0].width - w_original;
|
||||||
hw_layer->crop.x + (long long)(((long long)w_diff)<<32);
|
|
||||||
break;
|
break;
|
||||||
case TR_ROT_270:
|
case TR_ROT_270:
|
||||||
break;
|
break;
|
||||||
|
@ -545,11 +540,9 @@ 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)
|
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 long addr = 0;
|
||||||
unsigned int w_stride, h_stride;
|
unsigned int w_stride, h_stride;
|
||||||
int w_change, h_change, w_original, h_original;
|
int w_original, h_original;
|
||||||
|
|
||||||
if(hwc_need_check_format(tr_info->dst_frame.fmt))
|
if(hwc_need_check_format(tr_info->dst_frame.fmt))
|
||||||
{
|
{
|
||||||
|
@ -611,7 +604,6 @@ void hwc_rotate_finish(int cnt_st)
|
||||||
{
|
{
|
||||||
SUNXI_hwcdev_context_t *Globctx = &gSunxiHwcDevice;
|
SUNXI_hwcdev_context_t *Globctx = &gSunxiHwcDevice;
|
||||||
list_head_t *head = NULL;
|
list_head_t *head = NULL;
|
||||||
int j = 0;
|
|
||||||
if(cnt_st < Globctx->rotate_hold_cnt)
|
if(cnt_st < Globctx->rotate_hold_cnt)
|
||||||
{
|
{
|
||||||
head = Globctx->rotate_cache_list.prev;
|
head = Globctx->rotate_cache_list.prev;
|
||||||
|
@ -626,7 +618,7 @@ bool hwc_rotate_layer_tr(hwc_dispc_data_t *hwc_layer,
|
||||||
|
|
||||||
disp_layer_config *disp_layer = NULL;
|
disp_layer_config *disp_layer = NULL;
|
||||||
hwc_commit_layer_t *commit_layer = NULL;
|
hwc_commit_layer_t *commit_layer = NULL;
|
||||||
int lyr = 0, size = 0, i = 0, ret = -1, width = 0, height = 0;
|
int lyr = 0, size = 0, i = 0, ret = -1;
|
||||||
hwc_cache_t *tr_cache = NULL;
|
hwc_cache_t *tr_cache = NULL;
|
||||||
tr_info tr_info;
|
tr_info tr_info;
|
||||||
bool last = 0;
|
bool last = 0;
|
||||||
|
@ -723,7 +715,6 @@ tr2layer:
|
||||||
}else{
|
}else{
|
||||||
goto translat_err;
|
goto translat_err;
|
||||||
}
|
}
|
||||||
translat_ok:
|
|
||||||
close(commit_layer->share_fd);
|
close(commit_layer->share_fd);
|
||||||
commit_layer->share_fd = dup(tr_cache->share_fd);
|
commit_layer->share_fd = dup(tr_cache->share_fd);
|
||||||
commit_layer->tr = 0;
|
commit_layer->tr = 0;
|
||||||
|
|
|
@ -30,9 +30,7 @@ static mem_speed_limit_t mem_speed_limit[3] =
|
||||||
|
|
||||||
static void reset_layer_type(HwcDisContext_t *Localctx, int hwctype)
|
static void reset_layer_type(HwcDisContext_t *Localctx, int hwctype)
|
||||||
{
|
{
|
||||||
SUNXI_hwcdev_context_t *Globctx = &gSunxiHwcDevice;
|
|
||||||
int j = 0;
|
int j = 0;
|
||||||
struct private_handle_t *handle = NULL;
|
|
||||||
layer_info_t *psAllLayer = Localctx->psAllLayer;
|
layer_info_t *psAllLayer = Localctx->psAllLayer;
|
||||||
hwc_layer_1_t *psLayer = NULL;
|
hwc_layer_1_t *psLayer = NULL;
|
||||||
for(j = 0; j < Localctx->numberofLayer; j++)
|
for(j = 0; j < Localctx->numberofLayer; j++)
|
||||||
|
@ -231,7 +229,7 @@ static bool reset_globle(SUNXI_hwcdev_context_t *Globctx,
|
||||||
handle = (struct private_handle_t *)psLayer->handle;
|
handle = (struct private_handle_t *)psLayer->handle;
|
||||||
if(handle != NULL && psLayer->compositionType != HWC_FRAMEBUFFER_TARGET)
|
if(handle != NULL && psLayer->compositionType != HWC_FRAMEBUFFER_TARGET)
|
||||||
{
|
{
|
||||||
hwc_format_info(&psAllLayer[j].form_info, handle->format);
|
hwc_format_info(&psAllLayer[j].form_info, handle->iFormat);
|
||||||
tmp_mem_thruput0 += cal_layer_mem(&psAllLayer[j]);
|
tmp_mem_thruput0 += cal_layer_mem(&psAllLayer[j]);
|
||||||
}
|
}
|
||||||
if(psLayer->compositionType == HWC_FRAMEBUFFER_TARGET)
|
if(psLayer->compositionType == HWC_FRAMEBUFFER_TARGET)
|
||||||
|
@ -240,14 +238,14 @@ static bool reset_globle(SUNXI_hwcdev_context_t *Globctx,
|
||||||
Localctx->cur_fb_thruput = cal_layer_mem(&psAllLayer[j]);
|
Localctx->cur_fb_thruput = cal_layer_mem(&psAllLayer[j]);
|
||||||
all_mem_fb += Localctx->cur_fb_thruput;
|
all_mem_fb += Localctx->cur_fb_thruput;
|
||||||
}
|
}
|
||||||
if(handle != NULL && check_video(handle->format))
|
if(handle != NULL && check_video(handle->iFormat))
|
||||||
{
|
{
|
||||||
Localctx->video_mem += cal_layer_mem(&psAllLayer[j]);
|
Localctx->video_mem += cal_layer_mem(&psAllLayer[j]);
|
||||||
Localctx->video_cnt++;
|
Localctx->video_cnt++;
|
||||||
}
|
}
|
||||||
if(handle != NULL
|
if(handle != NULL
|
||||||
&& psLayer->transform != 0
|
&& psLayer->transform != 0
|
||||||
&& (handle->flags & private_handle_t::PRIV_FLAGS_USES_CONFIG))
|
&& (handle->flags & private_handle_t::PRIV_FLAGS_USES_ION))
|
||||||
{
|
{
|
||||||
has_tr = 1;
|
has_tr = 1;
|
||||||
}
|
}
|
||||||
|
@ -335,7 +333,7 @@ static AssignDUETO_T check_valid_layer(hwc_layer_1_t *layer)
|
||||||
return D_SKIP_LAYER;
|
return D_SKIP_LAYER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!check_valid_format(handle->format))
|
if (!check_valid_format(handle->iFormat))
|
||||||
{
|
{
|
||||||
return D_NO_FORMAT;
|
return D_NO_FORMAT;
|
||||||
}
|
}
|
||||||
|
@ -359,7 +357,7 @@ static bool check_fix_rotate(SUNXI_hwcdev_context_t *Globctx, hwc_layer_1_t *lay
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!check_rotate_format(handle->format))
|
if(!check_rotate_format(handle->iFormat))
|
||||||
{
|
{
|
||||||
goto tr_faild;
|
goto tr_faild;
|
||||||
}
|
}
|
||||||
|
@ -374,7 +372,6 @@ static bool check_fix_rotate(SUNXI_hwcdev_context_t *Globctx, hwc_layer_1_t *lay
|
||||||
goto tr_faild;
|
goto tr_faild;
|
||||||
}
|
}
|
||||||
|
|
||||||
tr_ok:
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
tr_faild:
|
tr_faild:
|
||||||
|
@ -687,8 +684,8 @@ static void resize_crop(rect64 *fb_crop,layer_info_t *hwc_layer, int *buffer_w,
|
||||||
int swap, s_left, s_right, s_top, s_bottom;
|
int swap, s_left, s_right, s_top, s_bottom;
|
||||||
hwc_layer_1_t *psLayer = hwc_layer->psLayer;
|
hwc_layer_1_t *psLayer = hwc_layer->psLayer;
|
||||||
struct private_handle_t *handle = (struct private_handle_t*)psLayer->handle;
|
struct private_handle_t *handle = (struct private_handle_t*)psLayer->handle;
|
||||||
handle_w = ALIGN(handle->width, hwc_layer->form_info.align[0]);
|
handle_w = ALIGN(handle->iWidth, hwc_layer->form_info.align[0]);
|
||||||
handle_h = handle->height;
|
handle_h = handle->iHeight;
|
||||||
#ifdef HWC_1_3
|
#ifdef HWC_1_3
|
||||||
|
|
||||||
sourceCrop.left = int(ceilf(psLayer->sourceCropf.left)) < 0 ? 0 : int(ceilf(psLayer->sourceCropf.left));
|
sourceCrop.left = int(ceilf(psLayer->sourceCropf.left)) < 0 ? 0 : int(ceilf(psLayer->sourceCropf.left));
|
||||||
|
@ -747,7 +744,6 @@ static bool resize_layer(HwcDisContext_t *Localctx,
|
||||||
int handle_w, handle_h;
|
int handle_w, handle_h;
|
||||||
hwc_layer_1_t *psLayer = hwc_layer->psLayer;
|
hwc_layer_1_t *psLayer = hwc_layer->psLayer;
|
||||||
float WScaleFactor = 1.0, HScaleFactor = 1.0;
|
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;
|
bool cut_left = 0, cut_right = 0, cut_top = 0, cut_bottom = 0;
|
||||||
const DisplayInfo *PsDisplayInfo = Localctx->psDisplayInfo;
|
const DisplayInfo *PsDisplayInfo = Localctx->psDisplayInfo;
|
||||||
rect64 Layer_crop[4];
|
rect64 Layer_crop[4];
|
||||||
|
@ -993,14 +989,14 @@ bool match_format(layer_info_t *psHwlayer_info, disp_layer_info *layer_info)
|
||||||
if(!err)
|
if(!err)
|
||||||
{
|
{
|
||||||
layer_info->fb.format = psHwlayer_info->form_info.format;
|
layer_info->fb.format = psHwlayer_info->form_info.format;
|
||||||
stride = ALIGN(handle->width, psHwlayer_info->form_info.align[0]);
|
stride = ALIGN(handle->iWidth, psHwlayer_info->form_info.align[0]);
|
||||||
i = 0;
|
i = 0;
|
||||||
while(i < psHwlayer_info->form_info.plannum)
|
while(i < psHwlayer_info->form_info.plannum)
|
||||||
{
|
{
|
||||||
layer_info->fb.size[i].width =
|
layer_info->fb.size[i].width =
|
||||||
ALIGN(stride / psHwlayer_info->form_info.planWscale[i], psHwlayer_info->form_info.align[i]);
|
ALIGN(stride / psHwlayer_info->form_info.planWscale[i], psHwlayer_info->form_info.align[i]);
|
||||||
layer_info->fb.size[i].height =
|
layer_info->fb.size[i].height =
|
||||||
handle->height / psHwlayer_info->form_info.planHscale[i];
|
handle->iHeight / psHwlayer_info->form_info.planHscale[i];
|
||||||
layer_info->fb.align[i] = psHwlayer_info->form_info.align[i];
|
layer_info->fb.align[i] = psHwlayer_info->form_info.align[i];
|
||||||
if(i > 0)
|
if(i > 0)
|
||||||
{
|
{
|
||||||
|
@ -1062,7 +1058,7 @@ HwcAssignStatus hwc_try_assign_layer(HwcDisContext_t *Localctx, size_t singcout,
|
||||||
dueto = D_NULL_BUF;
|
dueto = D_NULL_BUF;
|
||||||
goto assign_gpu;
|
goto assign_gpu;
|
||||||
}
|
}
|
||||||
isvideo = check_video(handle->format);
|
isvideo = check_video(handle->iFormat);
|
||||||
is3D = check_3d_video(PsDisplayInfo, psLayer);
|
is3D = check_3d_video(PsDisplayInfo, psLayer);
|
||||||
is_cursor = check_cursor(psLayer, singcout, Localctx->numberofLayer);
|
is_cursor = check_cursor(psLayer, singcout, Localctx->numberofLayer);
|
||||||
if(is3D)
|
if(is3D)
|
||||||
|
@ -1071,7 +1067,7 @@ HwcAssignStatus hwc_try_assign_layer(HwcDisContext_t *Localctx, size_t singcout,
|
||||||
addLayerCnt = 2;
|
addLayerCnt = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!(handle->flags & private_handle_t::PRIV_FLAGS_USES_CONFIG))
|
if(!(handle->flags & private_handle_t::PRIV_FLAGS_USES_ION))
|
||||||
{
|
{
|
||||||
ALOGV("%s:not continuous Memory", __func__);
|
ALOGV("%s:not continuous Memory", __func__);
|
||||||
Localctx->UsedFB = 1;
|
Localctx->UsedFB = 1;
|
||||||
|
@ -1094,7 +1090,7 @@ HwcAssignStatus hwc_try_assign_layer(HwcDisContext_t *Localctx, size_t singcout,
|
||||||
dueto = check_valid_layer(psLayer);
|
dueto = check_valid_layer(psLayer);
|
||||||
if(dueto != I_OVERLAY)
|
if(dueto != I_OVERLAY)
|
||||||
{
|
{
|
||||||
ALOGV("check_valid_layer:0x%08x", handle->format);
|
ALOGV("check_valid_layer:0x%08x", handle->iFormat);
|
||||||
goto assign_gpu;
|
goto assign_gpu;
|
||||||
}
|
}
|
||||||
if(check_usage_sw_write(handle))
|
if(check_usage_sw_write(handle))
|
||||||
|
@ -1127,7 +1123,7 @@ HwcAssignStatus hwc_try_assign_layer(HwcDisContext_t *Localctx, size_t singcout,
|
||||||
planealpha = psLayer->planeAlpha;
|
planealpha = psLayer->planeAlpha;
|
||||||
/*cann't distinguish only pixel alpha*/
|
/*cann't distinguish only pixel alpha*/
|
||||||
|
|
||||||
if(!check_support_blending(handle->format))
|
if(!check_support_blending(handle->iFormat))
|
||||||
{
|
{
|
||||||
ALOGV("not surpport alpha layer");
|
ALOGV("not surpport alpha layer");
|
||||||
dueto = D_ALPHA;
|
dueto = D_ALPHA;
|
||||||
|
@ -1146,7 +1142,7 @@ HwcAssignStatus hwc_try_assign_layer(HwcDisContext_t *Localctx, size_t singcout,
|
||||||
if(check_is_scale(PsDisplayInfo, psLayer, &WscalFac, &HscaleFac, isvideo)
|
if(check_is_scale(PsDisplayInfo, psLayer, &WscalFac, &HscaleFac, isvideo)
|
||||||
|| !check_same_scale(Localctx->WidthScaleFactor, Localctx->HighetScaleFactor, 1.0, 1.0))
|
|| !check_same_scale(Localctx->WidthScaleFactor, Localctx->HighetScaleFactor, 1.0, 1.0))
|
||||||
{
|
{
|
||||||
switch(check_scale_format(handle->format))
|
switch(check_scale_format(handle->iFormat))
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
if(!hwc_can_scale(Localctx, psLayer, isvideo))
|
if(!hwc_can_scale(Localctx, psLayer, isvideo))
|
||||||
|
@ -1176,7 +1172,7 @@ HwcAssignStatus hwc_try_assign_layer(HwcDisContext_t *Localctx, size_t singcout,
|
||||||
|
|
||||||
CH = Localctx->HwCHUsedCnt;
|
CH = Localctx->HwCHUsedCnt;
|
||||||
tmpCH = match_nofull_channel(Localctx, -1, isvideo, addLayerCnt,
|
tmpCH = match_nofull_channel(Localctx, -1, isvideo, addLayerCnt,
|
||||||
handle->format, WscalFac, HscaleFac, planealpha);
|
handle->iFormat, WscalFac, HscaleFac, planealpha);
|
||||||
|
|
||||||
while(tmpCH != -1 && CH !=-1 && CH >= tmpCH)
|
while(tmpCH != -1 && CH !=-1 && CH >= tmpCH)
|
||||||
{
|
{
|
||||||
|
@ -1185,7 +1181,7 @@ HwcAssignStatus hwc_try_assign_layer(HwcDisContext_t *Localctx, size_t singcout,
|
||||||
tmCnt2 = find_channel_layer(&Localctx->ChannelInfo[CH], 1);
|
tmCnt2 = find_channel_layer(&Localctx->ChannelInfo[CH], 1);
|
||||||
if((CH == tmpCH)
|
if((CH == tmpCH)
|
||||||
|| (match_nofull_channel(Localctx, CH, isvideo, addLayerCnt,
|
|| (match_nofull_channel(Localctx, CH, isvideo, addLayerCnt,
|
||||||
handle->format, WscalFac, HscaleFac, planealpha) != -1)
|
handle->iFormat, WscalFac, HscaleFac, planealpha) != -1)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if(check_cross_list(psLayer, Localctx, tmCnt1, tmCnt2, CH, ASSIGN_OVERLAY))
|
if(check_cross_list(psLayer, Localctx, tmCnt1, tmCnt2, CH, ASSIGN_OVERLAY))
|
||||||
|
@ -1273,21 +1269,20 @@ needchannel:
|
||||||
{
|
{
|
||||||
dueto = D_MEM_CTRL;
|
dueto = D_MEM_CTRL;
|
||||||
}
|
}
|
||||||
assign_overlay:
|
|
||||||
|
|
||||||
has_tr = (!is_cursor && psLayer->transform != 0);
|
has_tr = (!is_cursor && psLayer->transform != 0);
|
||||||
Localctx->unasignedVideo -= isvideo;
|
Localctx->unasignedVideo -= isvideo;
|
||||||
Localctx->countofhwlayer++;
|
Localctx->countofhwlayer++;
|
||||||
Localctx->has_tr += has_tr;
|
Localctx->has_tr += has_tr;
|
||||||
Globctx->has_tr_cnt += has_tr;
|
Globctx->has_tr_cnt += has_tr;
|
||||||
Localctx->tr_mem += has_tr ? (handle->width * handle->height) : 0;
|
Localctx->tr_mem += has_tr ? (handle->iWidth * handle->iHeight) : 0;
|
||||||
Globctx->has_tr_mem += has_tr ? (handle->width * handle->height) : 0;
|
Globctx->has_tr_mem += has_tr ? (handle->iWidth * handle->iHeight) : 0;
|
||||||
Globctx->has_secure += issecure;
|
Globctx->has_secure += issecure;
|
||||||
Globctx->has_3D += is3D;
|
Globctx->has_3D += is3D;
|
||||||
|
|
||||||
psCH[Localctx->HwCHUsedCnt - CHdiff].hasVideo = isvideo;
|
psCH[Localctx->HwCHUsedCnt - CHdiff].hasVideo = isvideo;
|
||||||
psCH[Localctx->HwCHUsedCnt - CHdiff].iCHFormat =
|
psCH[Localctx->HwCHUsedCnt - CHdiff].iCHFormat =
|
||||||
(handle == NULL ? HAL_PIXEL_FORMAT_BGRA_8888 : handle->format);
|
(handle == NULL ? HAL_PIXEL_FORMAT_BGRA_8888 : handle->iFormat);
|
||||||
psCH[Localctx->HwCHUsedCnt - CHdiff].WTScaleFactor =
|
psCH[Localctx->HwCHUsedCnt - CHdiff].WTScaleFactor =
|
||||||
WscalFac * Localctx->WidthScaleFactor;
|
WscalFac * Localctx->WidthScaleFactor;
|
||||||
psCH[Localctx->HwCHUsedCnt - CHdiff].HTScaleFactor =
|
psCH[Localctx->HwCHUsedCnt - CHdiff].HTScaleFactor =
|
||||||
|
@ -1351,7 +1346,6 @@ int hwc_setup_layer(hwc_dispc_data_t *DisplayData, HwcDisContext_t *Localctx)
|
||||||
hwc_commit_layer_t *hw_layer_config = NULL;
|
hwc_commit_layer_t *hw_layer_config = NULL;
|
||||||
const DisplayInfo *PsDisplayInfo = Localctx->psDisplayInfo;
|
const DisplayInfo *PsDisplayInfo = Localctx->psDisplayInfo;
|
||||||
ChannelInfo_t *psChannelInfo = Localctx->ChannelInfo;
|
ChannelInfo_t *psChannelInfo = Localctx->ChannelInfo;
|
||||||
struct private_handle_t *handle = NULL;
|
|
||||||
|
|
||||||
ture_disp = PsDisplayInfo->VirtualToHWDisplay;
|
ture_disp = PsDisplayInfo->VirtualToHWDisplay;
|
||||||
if(ture_disp < 0 || ture_disp >= NUMBEROFDISPLAY)
|
if(ture_disp < 0 || ture_disp >= NUMBEROFDISPLAY)
|
||||||
|
@ -1575,7 +1569,7 @@ ReAssignedLayer:
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case ASSIGN_FAILED:
|
case ASSIGN_FAILED:
|
||||||
ALOGD("Use GPU composite FB failed [%d]", disp);
|
ALOGD("Use GPU composite FB failed [%d]", (int)disp);
|
||||||
reset_local(Localctx);
|
reset_local(Localctx);
|
||||||
break;
|
break;
|
||||||
case ASSIGN_NEEDREASSIGNED:
|
case ASSIGN_NEEDREASSIGNED:
|
||||||
|
@ -1608,7 +1602,7 @@ bool sunxi_set(hwc_display_contents_1_t **displays, size_t numDisplays)
|
||||||
hwc_display_contents_1_t *psDisplay = NULL;
|
hwc_display_contents_1_t *psDisplay = NULL;
|
||||||
hwc_layer_1_t *fb_layer = NULL;
|
hwc_layer_1_t *fb_layer = NULL;
|
||||||
int ret = -1, mergfd = -1, ture_disp = -EINVAL;
|
int ret = -1, mergfd = -1, ture_disp = -EINVAL;
|
||||||
size_t disp, i, j;
|
size_t disp, i;
|
||||||
unsigned long arg[4] = {0};
|
unsigned long arg[4] = {0};
|
||||||
/* 0 for hardware DISP0,1 for DISP1,2 for WB,3 for FB Cache;*/
|
/* 0 for hardware DISP0,1 for DISP1,2 for WB,3 for FB Cache;*/
|
||||||
int returnfenceFd[CNOUTDISPSYNC] =
|
int returnfenceFd[CNOUTDISPSYNC] =
|
||||||
|
@ -1641,7 +1635,7 @@ bool sunxi_set(hwc_display_contents_1_t **displays, size_t numDisplays)
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ALOGV("display[%d] has no display content...", disp);
|
ALOGV("display[%d] has no display content...", (int)disp);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
fb_layer = &psDisplay->hwLayers[psDisplay->numHwLayers-1];
|
fb_layer = &psDisplay->hwLayers[psDisplay->numHwLayers-1];
|
||||||
|
@ -1718,7 +1712,7 @@ deal_fence:
|
||||||
ture_disp = PsDisplayInfo->VirtualToHWDisplay;
|
ture_disp = PsDisplayInfo->VirtualToHWDisplay;
|
||||||
if(!psDisplay)
|
if(!psDisplay)
|
||||||
{
|
{
|
||||||
ALOGV("%s: display[%d] was unexpectedly NULL", __func__, disp);
|
ALOGV("%s: display[%d] was unexpectedly NULL", __func__, (int)disp);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(ture_disp < NUMBEROFDISPLAY
|
if(ture_disp < NUMBEROFDISPLAY
|
||||||
|
@ -1789,7 +1783,7 @@ static int hwc_init_display(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
SUNXI_hwcdev_context_t *Globctx = &gSunxiHwcDevice;
|
SUNXI_hwcdev_context_t *Globctx = &gSunxiHwcDevice;
|
||||||
int refreshRate, xdpi, ydpi, vsync_period;
|
int refreshRate;
|
||||||
bool needupdate;
|
bool needupdate;
|
||||||
struct fb_var_screeninfo info;
|
struct fb_var_screeninfo info;
|
||||||
int arg[4] = {0};
|
int arg[4] = {0};
|
||||||
|
@ -1943,11 +1937,8 @@ SUNXI_hwcdev_context_t* hwc_create_device(void)
|
||||||
{
|
{
|
||||||
SUNXI_hwcdev_context_t *Globctx = &gSunxiHwcDevice;
|
SUNXI_hwcdev_context_t *Globctx = &gSunxiHwcDevice;
|
||||||
char property[PROPERTY_VALUE_MAX];
|
char property[PROPERTY_VALUE_MAX];
|
||||||
unsigned long arg[4] = {0};
|
|
||||||
int outtype;
|
|
||||||
int open_fd;
|
int open_fd;
|
||||||
int DispCnt, j;
|
int DispCnt, j;
|
||||||
disp_tv_mode hdmi_mode;
|
|
||||||
|
|
||||||
Globctx->DisplayFd = open("/dev/disp", O_RDWR);
|
Globctx->DisplayFd = open("/dev/disp", O_RDWR);
|
||||||
if (Globctx->DisplayFd < 0)
|
if (Globctx->DisplayFd < 0)
|
||||||
|
|
|
@ -320,9 +320,8 @@ static int hwc_uevent(void)
|
||||||
const int buffersize = 32*1024;
|
const int buffersize = 32*1024;
|
||||||
char *buf = NULL;
|
char *buf = NULL;
|
||||||
struct pollfd fds;
|
struct pollfd fds;
|
||||||
bool stop_hwc = 0;
|
|
||||||
int count, IsVsync, IsHdmi, hotplug_sock, retval, display_id = -1;
|
int count, IsVsync, IsHdmi, hotplug_sock, retval, display_id = -1;
|
||||||
unsigned int cout = 0, new_hdmi_hpd = 0;
|
unsigned int new_hdmi_hpd = 0;
|
||||||
uint64_t timestamp = 0;
|
uint64_t timestamp = 0;
|
||||||
const char *s = NULL;
|
const char *s = NULL;
|
||||||
SUNXI_hwcdev_context_t *Globctx = &gSunxiHwcDevice;
|
SUNXI_hwcdev_context_t *Globctx = &gSunxiHwcDevice;
|
||||||
|
@ -362,7 +361,6 @@ static int hwc_uevent(void)
|
||||||
double starttime = 0.0;
|
double starttime = 0.0;
|
||||||
gettimeofday(&tv, NULL);
|
gettimeofday(&tv, NULL);
|
||||||
starttime = tv.tv_sec * 1000 + tv.tv_usec / 1.0e3;
|
starttime = tv.tv_sec * 1000 + tv.tv_usec / 1.0e3;
|
||||||
double fCurrentTime = 0.0;
|
|
||||||
ALOGD("######hwc uevent Thread(%d)%p.#######", gettid(), &snl);
|
ALOGD("######hwc uevent Thread(%d)%p.#######", gettid(), &snl);
|
||||||
|
|
||||||
while(1)
|
while(1)
|
||||||
|
|
|
@ -34,7 +34,6 @@ void hwc_wb_manage(hwc_dispc_data_t *DisplayData, hwc_commit_data_t *commit_data
|
||||||
HWC_UNREFERENCED_PARAMETER(commit_data);
|
HWC_UNREFERENCED_PARAMETER(commit_data);
|
||||||
HWC_UNREFERENCED_PARAMETER(DisplayData);
|
HWC_UNREFERENCED_PARAMETER(DisplayData);
|
||||||
HWC_UNREFERENCED_PARAMETER(data);
|
HWC_UNREFERENCED_PARAMETER(data);
|
||||||
hwc_cache_t* hwc_cache = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -49,9 +49,8 @@ static int rgb_to_brightness(struct light_state_t const *state)
|
||||||
static int set_light_backlight(struct light_device_t *dev,
|
static int set_light_backlight(struct light_device_t *dev,
|
||||||
struct light_state_t const *state)
|
struct light_state_t const *state)
|
||||||
{
|
{
|
||||||
struct light_context_t *ctx;
|
(void)dev;
|
||||||
int brightness = rgb_to_brightness(state);
|
int brightness = rgb_to_brightness(state);
|
||||||
int i = 0;
|
|
||||||
unsigned long args[3];
|
unsigned long args[3];
|
||||||
int err = 0;
|
int err = 0;
|
||||||
pthread_mutex_lock(&g_lock);
|
pthread_mutex_lock(&g_lock);
|
||||||
|
@ -81,7 +80,6 @@ static int close_lights(struct light_device_t *dev)
|
||||||
static int open_lights(const struct hw_module_t *module, char const *name,
|
static int open_lights(const struct hw_module_t *module, char const *name,
|
||||||
struct hw_device_t **device)
|
struct hw_device_t **device)
|
||||||
{
|
{
|
||||||
pthread_t lighting_poll_thread;
|
|
||||||
|
|
||||||
int (*set_light) (struct light_device_t *dev,
|
int (*set_light) (struct light_device_t *dev,
|
||||||
struct light_state_t const *state);
|
struct light_state_t const *state);
|
||||||
|
|
Loading…
Reference in a new issue