summaryrefslogtreecommitdiffstats
path: root/hwc
diff options
context:
space:
mode:
authorMykola Ostrovskyy <mykola@ti.com>2012-09-25 13:13:41 +0300
committerDaniel Levin <dendy@ti.com>2012-11-28 21:16:26 +0200
commitd12a874e9a2c196481143559561b69e6c57dd301 (patch)
tree0f776c4c58d8d7e5dd80034168ac27db209280e5 /hwc
parent8e0c217e83f63c45fa4ea0bcc424a3a70c4dc4e7 (diff)
downloadhardware_ti_omap4-d12a874e9a2c196481143559561b69e6c57dd301.zip
hardware_ti_omap4-d12a874e9a2c196481143559561b69e6c57dd301.tar.gz
hardware_ti_omap4-d12a874e9a2c196481143559561b69e6c57dd301.tar.bz2
hwc: Move definition of omap4_hwc_device into a header file
This change will allow to split monolithic hwc.c file into a number of smaller, more manageable files with distinct functionality. Change-Id: I990fc4a37fc58d1c5e511347524bdbd547ce8c0c Signed-off-by: Mykola Ostrovskyy <mykola@ti.com>
Diffstat (limited to 'hwc')
-rw-r--r--hwc/hwc.c139
-rw-r--r--hwc/hwc_dev.h166
2 files changed, 167 insertions, 138 deletions
diff --git a/hwc/hwc.c b/hwc/hwc.c
index 9c47a01..c46f49c 100644
--- a/hwc/hwc.c
+++ b/hwc/hwc.c
@@ -48,6 +48,7 @@
#include <video/omap_hwc.h>
#include "hal_public.h"
+#include "hwc_dev.h"
#include "rgz_2d.h"
#define min(a, b) ( { typeof(a) __a = (a), __b = (b); __a < __b ? __a : __b; } )
@@ -65,66 +66,12 @@
#define NUM_EXT_DISPLAY_BACK_BUFFERS 2
#define ASPECT_RATIO_TOLERANCE 0.02f
-struct ext_transform {
- uint8_t rotation : 3; /* 90-degree clockwise rotations */
- uint8_t hflip : 1; /* flip l-r (after rotation) */
- uint8_t enabled : 1; /* cloning enabled */
- uint8_t docking : 1; /* docking vs. mirroring - used for state */
-};
-typedef struct ext_transform ext_transform_t;
-
-/* cloning support and state */
-struct omap4_hwc_ext {
- /* support */
- ext_transform_t mirror; /* mirroring settings */
- ext_transform_t dock; /* docking settings */
- float lcd_xpy; /* pixel ratio for UI */
- bool avoid_mode_change; /* use HDMI mode used for mirroring if possible */
- bool force_dock; /* must dock */
-
- /* state */
- bool hdmi_state; /* whether HDMI is connected */
- bool on_tv; /* using a tv */
- ext_transform_t current; /* current settings */
- ext_transform_t last; /* last-used settings */
-
- /* configuration */
- uint32_t last_xres_used; /* resolution and pixel ratio used for mode selection */
- uint32_t last_yres_used;
- uint32_t last_mode; /* 2-s complement of last HDMI mode set, 0 if none */
- uint32_t mirror_mode; /* 2-s complement of mode used when mirroring */
- float last_xpy;
- uint16_t width; /* external screen dimensions */
- uint16_t height;
- uint32_t xres; /* external screen resolution */
- uint32_t yres;
- float m[2][3]; /* external transformation matrix */
- hwc_rect_t mirror_region; /* region of screen to mirror */
-
- bool s3d_enabled;
- bool s3d_capable;
- enum S3DLayoutType s3d_type;
- enum S3DLayoutOrder s3d_order;
-};
-typedef struct omap4_hwc_ext omap4_hwc_ext_t;
-
/* used by property settings */
enum {
EXT_ROTATION = 3, /* rotation while mirroring */
EXT_HFLIP = (1 << 2), /* flip l-r on output (after rotation) */
};
-enum bltpolicy {
- BLTPOLICY_DISABLED = 0,
- BLTPOLICY_DEFAULT = 1, /* Default blit policy */
- BLTPOLICY_ALL, /* Test mode to attempt to blit all */
-};
-
-enum bltmode {
- BLTMODE_PAINT = 0, /* Attempt to blit layer by layer */
- BLTMODE_REGION = 1, /* Attempt to blit layers via regions */
-};
-
/* ARGB image */
struct omap4_hwc_img {
int width;
@@ -134,90 +81,6 @@ struct omap4_hwc_img {
uint8_t *ptr;
} dock_image = { .rowbytes = 0 };
-struct omap4_hwc_module {
- hwc_module_t base;
-
- IMG_framebuffer_device_public_t *fb_dev;
-};
-typedef struct omap4_hwc_module omap4_hwc_module_t;
-
-struct counts {
- uint32_t possible_overlay_layers;
- uint32_t composited_layers;
- uint32_t scaled_layers;
- uint32_t RGB;
- uint32_t BGR;
- uint32_t NV12;
- uint32_t dockable;
- uint32_t protected;
- uint32_t s3d;
-
- uint32_t max_hw_overlays;
- uint32_t max_scaling_overlays;
- uint32_t mem;
-};
-typedef struct counts counts_t;
-
-struct omap4_hwc_device {
- /* static data */
- hwc_composer_device_t base;
- hwc_procs_t *procs;
- pthread_t hdmi_thread;
- pthread_mutex_t lock;
-
- IMG_framebuffer_device_public_t *fb_dev;
- struct dsscomp_display_info fb_dis;
- int fb_fd; /* file descriptor for /dev/fb0 */
- int dsscomp_fd; /* file descriptor for /dev/dsscomp */
- int hdmi_fb_fd; /* file descriptor for /dev/fb1 */
- int pipe_fds[2]; /* pipe to event thread */
-
- int img_mem_size; /* size of fb for hdmi */
- void *img_mem_ptr; /* start of fb for hdmi */
-
- int flags_rgb_order;
- int flags_nv12_only;
- float upscaled_nv12_limit;
-
- bool on_tv; /* using a tv */
- int force_sgx;
- omap4_hwc_ext_t ext; /* external mirroring data */
- int idle;
-
- float primary_m[2][3]; /* internal transformation matrix */
- int primary_transform;
- int primary_rotation;
- hwc_rect_t primary_region;
-
- buffer_handle_t *buffers;
- bool use_sgx;
- bool swap_rb;
- uint32_t post2_layers; /* buffers used with DSS pipes*/
- uint32_t post2_blit_buffers; /* buffers used with blit */
- int ext_ovls; /* # of overlays on external display for current composition */
- int ext_ovls_wanted; /* # of overlays that should be on external display for current composition */
- int last_ext_ovls; /* # of overlays on external/internal display for last composition */
- int last_int_ovls;
-
- enum S3DLayoutType s3d_input_type;
- enum S3DLayoutOrder s3d_input_order;
-
- enum bltmode blt_mode;
- enum bltpolicy blt_policy;
-
- uint32_t blit_flags;
- int blit_num;
- struct omap_hwc_data comp_data; /* This is a kernel data structure */
- struct rgz_blt_entry blit_ops[RGZ_MAX_BLITS];
-
- counts_t counts;
-
- int ion_fd;
- struct ion_handle *ion_handles[2];
-
-};
-typedef struct omap4_hwc_device omap4_hwc_device_t;
-
#define HAL_FMT(f) ((f) == HAL_PIXEL_FORMAT_TI_NV12 ? "NV12" : \
(f) == HAL_PIXEL_FORMAT_TI_NV12_1D ? "NV12" : \
(f) == HAL_PIXEL_FORMAT_YV12 ? "YV12" : \
diff --git a/hwc/hwc_dev.h b/hwc/hwc_dev.h
new file mode 100644
index 0000000..8048637
--- /dev/null
+++ b/hwc/hwc_dev.h
@@ -0,0 +1,166 @@
+/*
+ * Copyright (C) Texas Instruments - http://www.ti.com/
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __HWC_DEV__
+#define __HWC_DEV__
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <hardware/hwcomposer.h>
+#include <ui/S3DFormat.h>
+
+#include "rgz_2d.h"
+
+struct ext_transform {
+ uint8_t rotation : 3; /* 90-degree clockwise rotations */
+ uint8_t hflip : 1; /* flip l-r (after rotation) */
+ uint8_t enabled : 1; /* cloning enabled */
+ uint8_t docking : 1; /* docking vs. mirroring - used for state */
+};
+typedef struct ext_transform ext_transform_t;
+
+/* cloning support and state */
+struct omap4_hwc_ext {
+ /* support */
+ ext_transform_t mirror; /* mirroring settings */
+ ext_transform_t dock; /* docking settings */
+ float lcd_xpy; /* pixel ratio for UI */
+ bool avoid_mode_change; /* use HDMI mode used for mirroring if possible */
+ bool force_dock; /* must dock */
+
+ /* state */
+ bool hdmi_state; /* whether HDMI is connected */
+ bool on_tv; /* using a tv */
+ ext_transform_t current; /* current settings */
+ ext_transform_t last; /* last-used settings */
+
+ /* configuration */
+ uint32_t last_xres_used; /* resolution and pixel ratio used for mode selection */
+ uint32_t last_yres_used;
+ uint32_t last_mode; /* 2-s complement of last HDMI mode set, 0 if none */
+ uint32_t mirror_mode; /* 2-s complement of mode used when mirroring */
+ float last_xpy;
+ uint16_t width; /* external screen dimensions */
+ uint16_t height;
+ uint32_t xres; /* external screen resolution */
+ uint32_t yres;
+ float m[2][3]; /* external transformation matrix */
+ hwc_rect_t mirror_region; /* region of screen to mirror */
+
+ bool s3d_enabled;
+ bool s3d_capable;
+ enum S3DLayoutType s3d_type;
+ enum S3DLayoutOrder s3d_order;
+};
+typedef struct omap4_hwc_ext omap4_hwc_ext_t;
+
+enum bltpolicy {
+ BLTPOLICY_DISABLED = 0,
+ BLTPOLICY_DEFAULT = 1, /* Default blit policy */
+ BLTPOLICY_ALL, /* Test mode to attempt to blit all */
+};
+
+enum bltmode {
+ BLTMODE_PAINT = 0, /* Attempt to blit layer by layer */
+ BLTMODE_REGION = 1, /* Attempt to blit layers via regions */
+};
+
+struct omap4_hwc_module {
+ hwc_module_t base;
+
+ IMG_framebuffer_device_public_t *fb_dev;
+};
+typedef struct omap4_hwc_module omap4_hwc_module_t;
+
+struct counts {
+ uint32_t possible_overlay_layers;
+ uint32_t composited_layers;
+ uint32_t scaled_layers;
+ uint32_t RGB;
+ uint32_t BGR;
+ uint32_t NV12;
+ uint32_t dockable;
+ uint32_t protected;
+ uint32_t s3d;
+
+ uint32_t max_hw_overlays;
+ uint32_t max_scaling_overlays;
+ uint32_t mem;
+};
+typedef struct counts counts_t;
+
+struct omap4_hwc_device {
+ /* static data */
+ hwc_composer_device_t base;
+ hwc_procs_t *procs;
+ pthread_t hdmi_thread;
+ pthread_mutex_t lock;
+
+ IMG_framebuffer_device_public_t *fb_dev;
+ struct dsscomp_display_info fb_dis;
+ int fb_fd; /* file descriptor for /dev/fb0 */
+ int dsscomp_fd; /* file descriptor for /dev/dsscomp */
+ int hdmi_fb_fd; /* file descriptor for /dev/fb1 */
+ int pipe_fds[2]; /* pipe to event thread */
+
+ int img_mem_size; /* size of fb for hdmi */
+ void *img_mem_ptr; /* start of fb for hdmi */
+
+ int flags_rgb_order;
+ int flags_nv12_only;
+ float upscaled_nv12_limit;
+
+ bool on_tv; /* using a tv */
+ int force_sgx;
+ omap4_hwc_ext_t ext; /* external mirroring data */
+ int idle;
+
+ float primary_m[2][3]; /* internal transformation matrix */
+ int primary_transform;
+ int primary_rotation;
+ hwc_rect_t primary_region;
+
+ buffer_handle_t *buffers;
+ bool use_sgx;
+ bool swap_rb;
+ uint32_t post2_layers; /* buffers used with DSS pipes*/
+ uint32_t post2_blit_buffers; /* buffers used with blit */
+ int ext_ovls; /* # of overlays on external display for current composition */
+ int ext_ovls_wanted; /* # of overlays that should be on external display for current composition */
+ int last_ext_ovls; /* # of overlays on external/internal display for last composition */
+ int last_int_ovls;
+
+ enum S3DLayoutType s3d_input_type;
+ enum S3DLayoutOrder s3d_input_order;
+
+ enum bltmode blt_mode;
+ enum bltpolicy blt_policy;
+
+ uint32_t blit_flags;
+ int blit_num;
+ struct omap_hwc_data comp_data; /* This is a kernel data structure */
+ struct rgz_blt_entry blit_ops[RGZ_MAX_BLITS];
+
+ counts_t counts;
+
+ int ion_fd;
+ struct ion_handle *ion_handles[2];
+
+};
+typedef struct omap4_hwc_device omap4_hwc_device_t;
+
+#endif