diff options
-rw-r--r-- | hardware.c | 16 | ||||
-rw-r--r-- | include/hardware/audio.h | 210 | ||||
-rw-r--r-- | include/hardware/audio_policy.h | 46 | ||||
-rw-r--r-- | include/hardware/fmradio.h | 172 | ||||
-rw-r--r-- | include/hardware/gralloc.h | 37 | ||||
-rw-r--r-- | include/hardware/hardware.h | 16 | ||||
-rw-r--r-- | include/hardware/hwcomposer.h | 5 | ||||
-rw-r--r-- | include/hardware/hwcomposer_defs.h | 6 | ||||
-rw-r--r-- | include/hardware/power.h | 19 | ||||
-rw-r--r-- | modules/audio/audio_hw.c | 12 | ||||
-rw-r--r-- | modules/audio/audio_policy.c | 4 |
11 files changed, 538 insertions, 5 deletions
@@ -89,11 +89,13 @@ static int load(const char *id, } /* Check that the id matches */ +#ifndef DISABLE_HW_ID_MATCH_CHECK if (strcmp(id, hmi->id) != 0) { ALOGE("load: id=%s != hmi->id=%s", id, hmi->id); status = -EINVAL; goto done; } +#endif /* DISABLE_HW_ID_MATCH_CHECK */ hmi->dso = handle; @@ -126,6 +128,10 @@ int hw_get_module_by_class(const char *class_id, const char *inst, char prop[PATH_MAX]; char path[PATH_MAX]; char name[PATH_MAX]; +#ifdef QCOM_HARDWARE + int is_mpq; + IS_TARGET_MPQ(is_mpq); +#endif if (inst) snprintf(name, PATH_MAX, "%s.%s", class_id, inst); @@ -149,6 +155,16 @@ int hw_get_module_by_class(const char *class_id, const char *inst, HAL_LIBRARY_PATH2, name, prop); if (access(path, R_OK) == 0) break; +#ifdef QCOM_HARDWARE + if ((!strncmp(name, "audio.primary", 13) || + !strncmp(name, "audio_policy", 12)) && + (is_mpq) && (!strncmp(prop, "msm8960", 7))) + { + strlcpy(prop, "mpq8064", 8); + ALOGE("setting prop to mpq8064"); + } +#endif + snprintf(path, sizeof(path), "%s/%s.%s.so", HAL_LIBRARY_PATH1, name, prop); if (access(path, R_OK) == 0) break; diff --git a/include/hardware/audio.h b/include/hardware/audio.h index 3a0962e..beac717 100644 --- a/include/hardware/audio.h +++ b/include/hardware/audio.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2011 The Android Open Source Project + * Copyright (c) 2012, Code Aurora Forum. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +20,7 @@ #define ANDROID_AUDIO_HAL_INTERFACE_H #include <stdint.h> +#include <string.h> #include <strings.h> #include <sys/cdefs.h> #include <sys/types.h> @@ -54,7 +56,11 @@ __BEGIN_DECLS #define AUDIO_DEVICE_API_VERSION_0_0 HARDWARE_DEVICE_API_VERSION(0, 0) #define AUDIO_DEVICE_API_VERSION_1_0 HARDWARE_DEVICE_API_VERSION(1, 0) #define AUDIO_DEVICE_API_VERSION_2_0 HARDWARE_DEVICE_API_VERSION(2, 0) +#ifndef ICS_AUDIO_BLOB #define AUDIO_DEVICE_API_VERSION_CURRENT AUDIO_DEVICE_API_VERSION_2_0 +#else +#define AUDIO_DEVICE_API_VERSION_CURRENT AUDIO_DEVICE_API_VERSION_1_0 +#endif /** * List of known audio HAL modules. This is the base name of the audio HAL @@ -117,7 +123,20 @@ __BEGIN_DECLS * "sup_sampling_rates=44100|48000" */ #define AUDIO_PARAMETER_STREAM_SUP_SAMPLING_RATES "sup_sampling_rates" +/* Query handle fm parameter*/ +#define AUDIO_PARAMETER_KEY_HANDLE_FM "handle_fm" +/* Query voip flag */ +#define AUDIO_PARAMETER_KEY_VOIP_CHECK "voip_flag" + +/* Query Fluence type */ +#define AUDIO_PARAMETER_KEY_FLUENCE_TYPE "fluence" + +/* Query if surround sound recording is supported */ +#define AUDIO_PARAMETER_KEY_SSR "ssr" + +/* Query if a2dp is supported */ +#define AUDIO_PARAMETER_KEY_HANDLE_A2DP_DEVICE "isA2dpDeviceSupported" /**************************************/ /* common audio stream configuration parameters */ @@ -128,6 +147,9 @@ struct audio_config { }; typedef struct audio_config audio_config_t; +#ifdef QCOM_HARDWARE +typedef struct buf_info; +#endif /* common audio stream parameters and operations */ struct audio_stream { @@ -252,16 +274,101 @@ struct audio_stream_out { int (*get_render_position)(const struct audio_stream_out *stream, uint32_t *dsp_frames); +#ifdef QCOM_HARDWARE + /** + * start audio data rendering + */ + int (*start)(struct audio_stream_out *stream); + + /** + * pause audio rendering + */ + int (*pause)(struct audio_stream_out *stream); + + /** + * flush audio data with driver + */ + int (*flush)(struct audio_stream_out *stream); + + /** + * stop audio data rendering + */ + int (*stop)(struct audio_stream_out *stream); +#endif + /** * get the local time at which the next write to the audio driver will be presented. * The units are microseconds, where the epoch is decided by the local audio HAL. */ int (*get_next_write_timestamp)(const struct audio_stream_out *stream, int64_t *timestamp); +#ifdef QCOM_HARDWARE + /** + * return the current timestamp after quering to the driver + */ + int (*get_time_stamp)(const struct audio_stream_out *stream, + uint64_t *time_stamp); + /** + * EOS notification from HAL to Player + */ + int (*set_observer)(const struct audio_stream_out *stream, + void *observer); + /** + * Get the physical address of the buffer allocated in the + * driver + */ + int (*get_buffer_info) (const struct audio_stream_out *stream, + struct buf_info **buf); + /** + * Check if next buffer is available. Waits until next buffer is + * available + */ + int (*is_buffer_available) (const struct audio_stream_out *stream, + int *isAvail); +#endif }; typedef struct audio_stream_out audio_stream_out_t; +#ifdef QCOM_HARDWARE +/** + * audio_broadcast_stream is the abstraction interface for the + * audio output hardware. + * + * It provides information about various properties of the audio output + * hardware driver. + */ + +struct audio_broadcast_stream { + struct audio_stream common; + + /** + * return the audio hardware driver latency in milli seconds. + */ + uint32_t (*get_latency)(const struct audio_broadcast_stream *stream); + + /** + * Use this method in situations where audio mixing is done in the + * hardware. This method serves as a direct interface with hardware, + * allowing you to directly set the volume as apposed to via the framework. + * This method might produce multiple PCM outputs or hardware accelerated + * codecs, such as MP3 or AAC. + */ + int (*set_volume)(struct audio_broadcast_stream *stream, float left, float right); + + int (*mute)(struct audio_broadcast_stream *stream, bool mute); + + int (*start)(struct audio_broadcast_stream *stream, int64_t absTimeToStart); + /** + * write audio buffer to driver. Returns number of bytes written + */ + ssize_t (*write)(struct audio_broadcast_stream *stream, const void* buffer, + size_t bytes, int64_t timestamp, int audioType); + +}; +typedef struct audio_broadcast_stream audio_broadcast_stream_t; +#endif + struct audio_stream_in { struct audio_stream common; @@ -296,8 +403,39 @@ typedef struct audio_stream_in audio_stream_in_t; static inline size_t audio_stream_frame_size(const struct audio_stream *s) { size_t chan_samp_sz; + uint32_t chan_mask = s->get_channels(s); + int format = s->get_format(s); - switch (s->get_format(s)) { +#ifdef QCOM_HARDWARE + if (!s) + return 0; + + if (audio_is_input_channel(chan_mask)) { + chan_mask &= (AUDIO_CHANNEL_IN_STEREO | \ + AUDIO_CHANNEL_IN_MONO | \ + AUDIO_CHANNEL_IN_5POINT1); + } + + if(!strncmp(s->get_parameters(s, "voip_flag"),"voip_flag=1",sizeof("voip_flag=1"))) { + if(format != AUDIO_FORMAT_PCM_8_BIT) + return popcount(chan_mask) * sizeof(int16_t); + else + return popcount(chan_mask) * sizeof(int8_t); + } +#endif + + switch (format) { +#ifdef QCOM_HARDWARE + case AUDIO_FORMAT_AMR_NB: + chan_samp_sz = 32; + break; + case AUDIO_FORMAT_EVRC: + chan_samp_sz = 23; + break; + case AUDIO_FORMAT_QCELP: + chan_samp_sz = 35; + break; +#endif case AUDIO_FORMAT_PCM_16_BIT: chan_samp_sz = sizeof(int16_t); break; @@ -307,7 +445,7 @@ static inline size_t audio_stream_frame_size(const struct audio_stream *s) break; } - return popcount(s->get_channels(s)) * chan_samp_sz; + return popcount(chan_mask) * chan_samp_sz; } @@ -355,6 +493,7 @@ struct audio_hw_device { */ int (*set_master_volume)(struct audio_hw_device *dev, float volume); +#ifndef ICS_AUDIO_BLOB /** * Get the current master volume value for the HAL, if the HAL supports * master volume control. AudioFlinger will query this value from the @@ -363,6 +502,12 @@ struct audio_hw_device { * this method may leave it set to NULL. */ int (*get_master_volume)(struct audio_hw_device *dev, float *volume); +#endif + +#ifdef QCOM_FM_ENABLED + /** set the fm audio volume. Range is between 0.0 and 1.0 */ + int (*set_fm_volume)(struct audio_hw_device *dev, float volume); +#endif /** * set_mode is called when the audio mode changes. AUDIO_MODE_NORMAL mode @@ -390,25 +535,65 @@ struct audio_hw_device { * See also get_buffer_size which is for a particular stream. */ size_t (*get_input_buffer_size)(const struct audio_hw_device *dev, +#ifndef ICS_AUDIO_BLOB const struct audio_config *config); +#else + uint32_t sample_rate, int format, + int channel_count); +#endif /** This method creates and opens the audio hardware output stream */ +#ifndef ICS_AUDIO_BLOB int (*open_output_stream)(struct audio_hw_device *dev, audio_io_handle_t handle, audio_devices_t devices, audio_output_flags_t flags, struct audio_config *config, struct audio_stream_out **stream_out); +#else + int (*open_output_stream)(struct audio_hw_device *dev, uint32_t devices, + int *format, uint32_t *channels, + uint32_t *sample_rate, + struct audio_stream_out **out); +#endif + +#ifdef QCOM_ICS_LPA_COMPAT + /** This method creates and opens the audio hardware output session */ + int (*open_output_session)(struct audio_hw_device *dev, uint32_t devices, + int *format, int sessionId, + struct audio_stream_out **out); +#endif void (*close_output_stream)(struct audio_hw_device *dev, struct audio_stream_out* stream_out); +#ifdef QCOM_HARDWARE + /** This method creates and opens the audio hardware output + * for broadcast stream */ + int (*open_broadcast_stream)(struct audio_hw_device *dev, uint32_t devices, + int format, uint32_t channels, + uint32_t sample_rate, + uint32_t audio_source, + struct audio_broadcast_stream **out); + + void (*close_broadcast_stream)(struct audio_hw_device *dev, + struct audio_broadcast_stream *out); +#endif + /** This method creates and opens the audio hardware input stream */ +#ifndef ICS_AUDIO_BLOB int (*open_input_stream)(struct audio_hw_device *dev, audio_io_handle_t handle, audio_devices_t devices, struct audio_config *config, struct audio_stream_in **stream_in); +#else + int (*open_input_stream)(struct audio_hw_device *dev, uint32_t devices, + int *format, uint32_t *channels, + uint32_t *sample_rate, + audio_in_acoustics_t acoustics, + struct audio_stream_in **stream_in); +#endif void (*close_input_stream)(struct audio_hw_device *dev, struct audio_stream_in *stream_in); @@ -416,6 +601,7 @@ struct audio_hw_device { /** This method dumps the state of the audio hardware */ int (*dump)(const struct audio_hw_device *dev, int fd); +#ifndef ICS_AUDIO_BLOB /** * set the audio mute status for all audio activities. If any value other * than 0 is returned, the software mixer will emulate this capability. @@ -430,6 +616,7 @@ struct audio_hw_device { * method may leave it set to NULL. */ int (*get_master_mute)(struct audio_hw_device *dev, bool *mute); +#endif }; typedef struct audio_hw_device audio_hw_device_t; @@ -447,7 +634,26 @@ static inline int audio_hw_device_close(struct audio_hw_device* device) return device->common.close(&device->common); } +#ifdef QCOM_HARDWARE +/** Structure to save buffer information for applying effects for + * LPA buffers */ +struct buf_info { + int bufsize; + int nBufs; + int **buffers; +}; +#ifdef __cplusplus +/** + *Observer class to post the Events from HAL to Flinger +*/ +class AudioEventObserver { +public: + virtual ~AudioEventObserver() {} + virtual void postEOS(int64_t delayUs) = 0; +}; +#endif +#endif __END_DECLS #endif // ANDROID_AUDIO_INTERFACE_H diff --git a/include/hardware/audio_policy.h b/include/hardware/audio_policy.h index 9e145f8..775573c 100644 --- a/include/hardware/audio_policy.h +++ b/include/hardware/audio_policy.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2011 The Android Open Source Project + * Copyright (c) 2012, Code Aurora Forum. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -126,6 +127,30 @@ struct audio_policy { * Audio routing query functions */ +#ifdef QCOM_ICS_LPA_COMPAT + /* request an session appropriate for playback of the supplied stream type and + * parameters */ + audio_io_handle_t (*get_session)(struct audio_policy *pol, + audio_stream_type_t stream, + uint32_t format, + audio_output_flags_t flags, + int sessionId); + + /* pause session created for LPA Playback */ + void (*pause_session)(struct audio_policy *pol, + audio_io_handle_t output, + audio_stream_type_t stream); + + /* resume session created for LPA Playback */ + void (*resume_session)(struct audio_policy *pol, + audio_io_handle_t output, + audio_stream_type_t stream); + + /* release session created for LPA Playback */ + void (*release_session)(struct audio_policy *pol, + audio_io_handle_t output); +#endif + /* request an output appropriate for playback of the supplied stream type and * parameters */ audio_io_handle_t (*get_output)(struct audio_policy *pol, @@ -191,6 +216,7 @@ struct audio_policy { audio_stream_type_t stream, int *index); +#ifndef ICS_AUDIO_BLOB /* sets the new stream volume at a level corresponding to the supplied * index for the specified device. * The index is within the range specified by init_stream_volume() */ @@ -204,6 +230,7 @@ struct audio_policy { audio_stream_type_t stream, int *index, audio_devices_t device); +#endif /* return the strategy corresponding to a given stream type */ uint32_t (*get_strategy_for_stream)(const struct audio_policy *pol, @@ -268,6 +295,18 @@ struct audio_policy_service_ops { uint32_t *pLatencyMs, audio_output_flags_t flags); +#ifdef QCOM_ICS_LPA_COMPAT + audio_io_handle_t (*open_session)(void *service, + uint32_t *pDevices, + uint32_t *pFormat, + audio_output_flags_t flags, + int32_t stream, + int32_t sessionId); + + audio_io_handle_t (*close_session)(void *service, + audio_io_handle_t output); +#endif + /* creates a special output that is duplicated to the two outputs passed as * arguments. The duplication is performed by * a special mixer thread in the AudioFlinger. @@ -366,6 +405,13 @@ struct audio_policy_service_ops { audio_io_handle_t src_output, audio_io_handle_t dst_output); +#ifdef QCOM_FM_ENABLED + /* set fm audio volume. */ + int (*set_fm_volume)(void *service, + float volume, + int delay_ms); +#endif + /* loads an audio hw module. * * The module name passed is the base name of the HW module library, e.g "primary" or "a2dp". diff --git a/include/hardware/fmradio.h b/include/hardware/fmradio.h new file mode 100644 index 0000000..49b3ded --- /dev/null +++ b/include/hardware/fmradio.h @@ -0,0 +1,172 @@ +/* + * Copyright (C) ST-Ericsson SA 2010 + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Author: johan.xj.palmaeus@stericsson.com for ST-Ericsson + */ + +/* + * Interface file between the vendor specific drivers and the fmradio + * jni layer. The vendor driver need to define register function with + * name defined by FMRADIO_REGISTER_FUNC of type fmradio_reg_func_t that + * will return a pointer to a signature (FMRADIO_SIGNATURE) to make sure + * it executed correctly and fill struct fmradio_vendor_methods with + * functions implementing functions (or NULL if not supported). + */ + +#ifndef ANDROID_FMRADIO_INTERFACE_H +#define ANDROID_FMRADIO_INTERFACE_H + +__BEGIN_DECLS + +#define FMRADIO_REGISTER_FUNC "register_fmradio_functions" + +#define FMRADIO_SIGNATURE 0xDEADBABE + +#define FMRADIO_CAPABILITY_RECEIVER 0x0001 +#define FMRADIO_CAPABILITY_TRANSMITTER 0x0002 +#define FMRADIO_CAPABILITY_TUNER_WRAP_AROUND 0x0004 +#define FMRADIO_CAPABILITY_RDS_SUPPORTED 0x0008 + +/* + * return values. Not defined as enum since some functions either + * return a positive value or these codes, like getFrequency. + */ +#define FMRADIO_OK 0 +#define FMRADIO_INVALID_STATE -1 /* internally in jni layer */ +#define FMRADIO_UNSUPPORTED_OPERATION -2 +#define FMRADIO_IO_ERROR -3 +#define FMRADIO_INVALID_PARAMETER -4 +#define FMRADIO_FORCED_RESET -5 + +/* RDS */ +#define RDS_MAX_AFS 25 +#define RDS_PSN_MAX_LENGTH 8 +#define RDS_RT_MAX_LENGTH 64 +#define RDS_CT_MAX_LENGTH 14 +#define RDS_PTYN_MAX_LENGTH 8 +#define RDS_NUMBER_OF_TMC 3 + +enum fmradio_band_t { + FMRADIO_BAND_US, + FMRADIO_BAND_EU, + FMRADIO_BAND_JAPAN, + FMRADIO_BAND_CHINA +}; + +enum fmradio_seek_direction_t { + FMRADIO_SEEK_DOWN, + FMRADIO_SEEK_UP +}; + +enum fmradio_reset_reason_t { + FMRADIO_RESET_NON_CRITICAL = 0, + FMRADIO_RESET_CRITICAL, + FMRADIO_RESET_OTHER_IN_USE, /* internally in jni layer */ + FMRADIO_RESET_RADIO_FORBIDDEN, /* internally in java layer */ +}; + +enum fmradio_extra_command_type_t { + FMRADIO_TYPE_INT, + FMRADIO_TYPE_STRING +}; + +enum fmradio_switch_reason_t { + FMRADIO_SWITCH_AF, + FMRADIO_SWITCH_TA, + FMRADIO_SWITCH_TA_END +}; + +union fmradio_extra_data_t { + int int_value; + char *string_value; +}; + +struct fmradio_rds_bundle_t { + unsigned short pi; + short tp; + short pty; + short ta; + short ms; + short num_afs; + int af[RDS_MAX_AFS]; + char psn[RDS_PSN_MAX_LENGTH + 1]; + char rt[RDS_RT_MAX_LENGTH + 1]; + char ct[RDS_CT_MAX_LENGTH + 1]; + char ptyn[RDS_PTYN_MAX_LENGTH + 1]; + short tmc[RDS_NUMBER_OF_TMC]; + int taf; +}; + +struct fmradio_extra_command_ret_item_t { + char *key; + enum fmradio_extra_command_type_t type; + union fmradio_extra_data_t data; +}; + +/* vendor callbacks only for RX */ +struct fmradio_vendor_callbacks_t { + void (*on_playing_in_stereo_changed) (int is_stereo); + void (*on_rds_data_found) (struct fmradio_rds_bundle_t * rds_bundle, + int frequency); + void (*on_signal_strength_changed) (int new_level); + void (*on_automatic_switch) (int new_freq, + enum fmradio_switch_reason_t reason); + void (*on_forced_reset) (enum fmradio_reset_reason_t reason); +}; + +struct fmradio_vendor_methods_t { + int (*rx_start) (void ** session_data, + const struct fmradio_vendor_callbacks_t * callbacks, + int low_freq, int high_freq, int default_freq, int grid); + int (*tx_start) (void ** session_data, + const struct fmradio_vendor_callbacks_t * callbacks, + int low_freq, int high_freq, int default_freq, int grid); + int (*pause) (void ** session_data); + int (*resume) (void ** session_data); + int (*reset) (void ** session_data); + int (*set_frequency) (void ** session_data, int frequency); + int (*get_frequency) (void ** session_data); + int (*stop_scan) (void ** session_data); + int (*send_extra_command) (void ** session_data, const char * command, + char ** parameters, + struct fmradio_extra_command_ret_item_t ** out_parameters); + /* rx only */ + int (*scan) (void ** session_data, enum fmradio_seek_direction_t direction); + + int (*full_scan) (void ** session_data, int ** found_freqs, + int ** signal_strenghts); + int (*get_signal_strength) (void ** session_data); + int (*is_playing_in_stereo) (void ** session_data); + int (*is_rds_data_supported) (void ** session_data); + int (*is_tuned_to_valid_channel) (void ** session_data); + int (*set_automatic_af_switching) (void ** session_data, int automatic); + int (*set_automatic_ta_switching) (void ** session_data, int automatic); + int (*set_force_mono) (void ** session_data, int force_mono); + int (*get_threshold) (void ** session_data); + int (*set_threshold) (void ** session_data, int threshold); + int (*set_rds_reception) (void ** session_data, int use_rds); + /* tx only */ + int (*block_scan) (void ** session_data, int low_freq, int high_freq, + int ** found_freqs, int ** signal_strenghts); + int (*set_rds_data) (void ** session_data, char * key, void * value); +}; + +typedef int (*fmradio_reg_func_t) (unsigned int * signature_p, + struct fmradio_vendor_methods_t * vendor_funcs_p); + +__END_DECLS + +#endif // ANDROID_FMRADIO_INTERFACE_H diff --git a/include/hardware/gralloc.h b/include/hardware/gralloc.h index 7c819f0..b758b57 100644 --- a/include/hardware/gralloc.h +++ b/include/hardware/gralloc.h @@ -106,8 +106,26 @@ enum { GRALLOC_USAGE_PRIVATE_2 = 0x40000000, GRALLOC_USAGE_PRIVATE_3 = 0x80000000, GRALLOC_USAGE_PRIVATE_MASK = 0xF0000000, + +#ifdef EXYNOS4_ENHANCEMENTS + /* SAMSUNG */ + GRALLOC_USAGE_PRIVATE_NONECACHE = 0x00800000, + + GRALLOC_USAGE_HW_FIMC1 = 0x01000000, + GRALLOC_USAGE_HW_ION = 0x02000000, + GRALLOC_USAGE_YUV_ADDR = 0x04000000, + GRALLOC_USAGE_CAMERA = 0x08000000, + + /* SEC Private usage , for Overlay path at HWC */ + GRALLOC_USAGE_HWC_HWOVERLAY = 0x20000000, +#endif }; +enum { + /* Gralloc perform enums */ + GRALLOC_MODULE_PERFORM_UPDATE_BUFFER_GEOMETRY = 0, + GRALLOC_MODULE_PERFORM_PRIVATE_START +}; /*****************************************************************************/ /** @@ -196,6 +214,10 @@ typedef struct gralloc_module_t { int (*unlock)(struct gralloc_module_t const* module, buffer_handle_t handle); +#ifdef EXYNOS4_ENHANCEMENTS + int (*getphys) (struct gralloc_module_t const* module, + buffer_handle_t handle, void** paddr); +#endif /* reserved for future use */ int (*perform)(struct gralloc_module_t const* module, @@ -215,6 +237,21 @@ typedef struct gralloc_module_t { typedef struct alloc_device_t { struct hw_device_t common; +#ifdef QCOM_HARDWARE + /* + * (*allocSize)() Allocates a buffer in graphic memory with the requested + * bufferSize parameter and returns a buffer_handle_t and the stride in + * pixels to allow the implementation to satisfy hardware constraints on + * the width of a pixmap (eg: it may have to be multiple of 8 pixels). + * The CALLER TAKES OWNERSHIP of the buffer_handle_t. + * + * Returns 0 on success or -errno on error. + */ + int (*allocSize)(struct alloc_device_t* dev, + int w, int h, int format, int usage, + buffer_handle_t* handle, int* stride, int bufferSize); +#endif + /* * (*alloc)() Allocates a buffer in graphic memory with the requested * parameters and returns a buffer_handle_t and the stride in pixels to diff --git a/include/hardware/hardware.h b/include/hardware/hardware.h index 416ae39..37a5a15 100644 --- a/include/hardware/hardware.h +++ b/include/hardware/hardware.h @@ -33,7 +33,21 @@ __BEGIN_DECLS #define HARDWARE_MODULE_TAG MAKE_TAG_CONSTANT('H', 'W', 'M', 'T') #define HARDWARE_DEVICE_TAG MAKE_TAG_CONSTANT('H', 'W', 'D', 'T') - +#ifdef QCOM_HARDWARE +#define IS_TARGET_MPQ(status) \ +{ \ + int id = 0; \ + FILE *fp; \ + if ((fp = fopen("/sys/devices/system/soc/soc0/id", "r")) != NULL) { \ + fscanf(fp, "%d", &id); \ + fclose(fp); \ + } \ + if (id == 130) \ + status = 1; \ + else \ + status = 0;\ +} +#endif #define HARDWARE_MAKE_API_VERSION(maj,min) \ ((((maj) & 0xff) << 8) | ((min) & 0xff)) diff --git a/include/hardware/hwcomposer.h b/include/hardware/hwcomposer.h index c30ef33..403e4a5 100644 --- a/include/hardware/hwcomposer.h +++ b/include/hardware/hwcomposer.h @@ -157,6 +157,11 @@ typedef struct hwc_layer_1 { /* transformation to apply to the buffer during composition */ uint32_t transform; +#ifdef QCOM_HARDWARE + /* source transform of the buffer */ + uint32_t sourceTransform; +#endif + /* blending to apply during composition */ int32_t blending; diff --git a/include/hardware/hwcomposer_defs.h b/include/hardware/hwcomposer_defs.h index ef8fcf1..8ec048b 100644 --- a/include/hardware/hwcomposer_defs.h +++ b/include/hardware/hwcomposer_defs.h @@ -97,6 +97,9 @@ enum { /* this layer holds the result of compositing the HWC_FRAMEBUFFER layers. * Added in HWC_DEVICE_API_VERSION_1_1. */ HWC_FRAMEBUFFER_TARGET = 3, + + /* this layer will be handled in the HWC, using a blit engine */ + HWC_BLIT = 4, }; /* @@ -179,7 +182,8 @@ enum { /* Allowed events for hwc_methods::eventControl() */ enum { - HWC_EVENT_VSYNC = 0 + HWC_EVENT_VSYNC = 0, + HWC_EVENT_ORIENTATION // To notify HWC about the device orientation }; /* Display types and associated mask bits. */ diff --git a/include/hardware/power.h b/include/hardware/power.h index 6c55061..b3724f0 100644 --- a/include/hardware/power.h +++ b/include/hardware/power.h @@ -41,6 +41,8 @@ __BEGIN_DECLS typedef enum { POWER_HINT_VSYNC = 0x00000001, POWER_HINT_INTERACTION = 0x00000002, + POWER_HINT_VIDEO_ENCODE = 0x00000003, + POWER_HINT_CPU_BOOST = 0x00000004, } power_hint_t; /** @@ -108,6 +110,23 @@ typedef struct power_module { * and it may be appropriate to raise speeds of CPU, memory bus, * etc. The data parameter is unused. * + * POWER_HINT_VIDEO_ENCODE + * + * The user just started or stopped recording video. When encode + * begins, large writes to the SD card will be done and this may + * cause CPU frequency to increase. The data parameter is a string + * with semicolon-separated 'key:value' pairs. The most common key is + * 'state', which takes 0 or 1 as its value. For instance, To + * indicate that recording is beginning, the string "state:1" would + * need to be used. More keys can be provided depending on the data + * that is to be passed. + * + * POWER_HINT_CPU_BOOST + * + * An operation is happening where it would be ideal for the CPU to + * be boosted for a specific duration. The data parameter is an + * integer value of the boost duration in microseconds. + * * A particular platform may choose to ignore any hint. * * availability: version 0.2 diff --git a/modules/audio/audio_hw.c b/modules/audio/audio_hw.c index 3051519..b051cf9 100644 --- a/modules/audio/audio_hw.c +++ b/modules/audio/audio_hw.c @@ -126,11 +126,13 @@ static int out_remove_audio_effect(const struct audio_stream *stream, effect_han return 0; } +#ifndef ICS_AUDIO_BLOB static int out_get_next_write_timestamp(const struct audio_stream_out *stream, int64_t *timestamp) { return -EINVAL; } +#endif /** audio_stream_in implementation **/ static uint32_t in_get_sample_rate(const struct audio_stream *stream) @@ -244,7 +246,9 @@ static int adev_open_output_stream(struct audio_hw_device *dev, out->stream.set_volume = out_set_volume; out->stream.write = out_write; out->stream.get_render_position = out_get_render_position; +#ifndef ICS_AUDIO_BLOB out->stream.get_next_write_timestamp = out_get_next_write_timestamp; +#endif *stream_out = &out->stream; return 0; @@ -287,6 +291,7 @@ static int adev_set_master_volume(struct audio_hw_device *dev, float volume) return -ENOSYS; } +#ifndef ICS_AUDIO_BLOB static int adev_get_master_volume(struct audio_hw_device *dev, float *volume) { return -ENOSYS; @@ -301,6 +306,7 @@ static int adev_get_master_mute(struct audio_hw_device *dev, bool *muted) { return -ENOSYS; } +#endif static int adev_set_mode(struct audio_hw_device *dev, audio_mode_t mode) { @@ -400,18 +406,22 @@ static int adev_open(const hw_module_t* module, const char* name, adev->device.init_check = adev_init_check; adev->device.set_voice_volume = adev_set_voice_volume; adev->device.set_master_volume = adev_set_master_volume; +#ifndef ICS_AUDIO_BLOB adev->device.get_master_volume = adev_get_master_volume; adev->device.set_master_mute = adev_set_master_mute; adev->device.get_master_mute = adev_get_master_mute; +#endif adev->device.set_mode = adev_set_mode; adev->device.set_mic_mute = adev_set_mic_mute; adev->device.get_mic_mute = adev_get_mic_mute; adev->device.set_parameters = adev_set_parameters; adev->device.get_parameters = adev_get_parameters; +#ifndef ICS_AUDIO_BLOB adev->device.get_input_buffer_size = adev_get_input_buffer_size; adev->device.open_output_stream = adev_open_output_stream; - adev->device.close_output_stream = adev_close_output_stream; adev->device.open_input_stream = adev_open_input_stream; +#endif + adev->device.close_output_stream = adev_close_output_stream; adev->device.close_input_stream = adev_close_input_stream; adev->device.dump = adev_dump; diff --git a/modules/audio/audio_policy.c b/modules/audio/audio_policy.c index 2dd3dbe..82aa449 100644 --- a/modules/audio/audio_policy.c +++ b/modules/audio/audio_policy.c @@ -164,6 +164,7 @@ static int ap_get_stream_volume_index(const struct audio_policy *pol, return -ENOSYS; } +#ifndef ICS_AUDIO_BLOB static int ap_set_stream_volume_index_for_device(struct audio_policy *pol, audio_stream_type_t stream, int index, @@ -179,6 +180,7 @@ static int ap_get_stream_volume_index_for_device(const struct audio_policy *pol, { return -ENOSYS; } +#endif static uint32_t ap_get_strategy_for_stream(const struct audio_policy *pol, audio_stream_type_t stream) @@ -267,8 +269,10 @@ static int create_default_ap(const struct audio_policy_device *device, dap->policy.init_stream_volume = ap_init_stream_volume; dap->policy.set_stream_volume_index = ap_set_stream_volume_index; dap->policy.get_stream_volume_index = ap_get_stream_volume_index; +#ifndef ICS_AUDIO_BLOB dap->policy.set_stream_volume_index_for_device = ap_set_stream_volume_index_for_device; dap->policy.get_stream_volume_index_for_device = ap_get_stream_volume_index_for_device; +#endif dap->policy.get_strategy_for_stream = ap_get_strategy_for_stream; dap->policy.get_devices_for_stream = ap_get_devices_for_stream; dap->policy.get_output_for_effect = ap_get_output_for_effect; |