summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorLajos Molnar <molnar@ti.com>2010-04-09 19:15:50 -0500
committerDavid Sin <davidsin@ti.com>2010-06-02 09:53:28 -0500
commit3b411fc354e1f673b28f3b66fbcd5d3cdcf63bb9 (patch)
treeb8607766d5f562d8a340d2bcc9b35912af649447 /drivers
parent5c184b4346d3a4ebd97b0dc837cc1c8370de12fc (diff)
TILER: Initial reorganization of TCM files.
Moved TCM files to their correct location to be able to see future diffs. Signed-off-by: Lajos Molnar <molnar@ti.com>
Diffstat (limited to 'drivers')
-rwxr-xr-x[-rw-r--r--]drivers/media/video/tiler/tcm/Makefile3
-rw-r--r--drivers/media/video/tiler/tcm/tcm_pri.h87
-rw-r--r--drivers/media/video/tiler/tcm/tcm_rr.c (renamed from drivers/media/video/tiler/tcm/tcm.c)0
-rw-r--r--drivers/media/video/tiler/tcm/tcm_utils.c183
-rw-r--r--drivers/media/video/tiler/tcm/tcm_utils.h188
5 files changed, 174 insertions, 287 deletions
diff --git a/drivers/media/video/tiler/tcm/Makefile b/drivers/media/video/tiler/tcm/Makefile
index bde1d9c31a83..4f9fa2d9120e 100644..100755
--- a/drivers/media/video/tiler/tcm/Makefile
+++ b/drivers/media/video/tiler/tcm/Makefile
@@ -1,3 +1,2 @@
-obj-$(CONFIG_TILER_OMAP) += tcm_omap.o
-tcm_omap-objs = tcm.o tcm_utils.o
+obj-$(CONFIG_TILER_OMAP) += tcm_rr.o
diff --git a/drivers/media/video/tiler/tcm/tcm_pri.h b/drivers/media/video/tiler/tcm/tcm_pri.h
deleted file mode 100644
index 6f4a33c6801b..000000000000
--- a/drivers/media/video/tiler/tcm/tcm_pri.h
+++ /dev/null
@@ -1,87 +0,0 @@
-#ifndef _TCM_PRIVATE_H_
-#define _TCM_PRIVATE_H_
-
-#define IN
-#define OUT
-#define INOUT
-
-#define MAX_X_DIMMENSION 256
-#define MAX_Y_DIMMENSION 128
-
-#define YES 1
-#define NO 0
-
-#define TL_CORNER 0
-#define TR_CORNER 1
-#define BL_CORNER 3
-#define BR_CORNER 4
-
-
-/*Note Alignment 64 gets the highest priority */
-#define ALIGN_STRIDE(align)((align == ALIGN_64) ? 64 : ((align == ALIGN_32) ? \
- 32 : ((align == ALIGN_16) ? 16 : 1)))
-
-enum tiler_error {
- TilerErrorNone = 0,
- TilerErrorGeneral = -1,
- TilerErrorInvalidDimension = -2,
- TilerErrorNoRoom = -3,
- TilerErrorInvalidArg = -4,
- TilerErrorMatchNotFound = -5,
- TilerErrorOverFlow = -6,
- TilerErrorInvalidScanArea = -7,
- TilerErrorNotSupported = -8,
-};
-
-enum alignment {
- ALIGN_NONE = 0,
- /*ALIGN_16 = 0x1,*/
- ALIGN_32 = 0x1, /*0x2 */
- ALIGN_64 = 0x2, /*0x4 */
- ALIGN_16 = 0x3 /* 0x1*/
-};
-
-enum dim_type {
- ONE_D = 1,
- TWO_D = 2
-};
-
-
-struct area_spec {
- u16 x0;
- u16 y0;
- u16 x1;
- u16 y1;
-};
-
-
-struct area_spec_list;
-
-struct area_spec_list {
- struct area_spec area;
- u16 area_type;
- struct area_spec_list *next;
-};
-
-
-/*Everything is a rectangle with four sides and on
- * each side you could have a boundaryor another Tile.
- * The tile could be Occupied or Not. These info is stored
- */
-struct neighbour_stats {
- /* num of tiles on left touching the boundary */
- u16 left_boundary;
- /* num of tiles on left that are occupied */
- u16 left_occupied;
-
- u16 top_boundary;
- u16 top_occupied;
-
- u16 right_boundary;
- u16 right_occupied;
-
- u16 bottom_boundary;
- u16 bottom_occupied;
-};
-
-#endif
diff --git a/drivers/media/video/tiler/tcm/tcm.c b/drivers/media/video/tiler/tcm/tcm_rr.c
index 340207f6d7af..340207f6d7af 100644
--- a/drivers/media/video/tiler/tcm/tcm.c
+++ b/drivers/media/video/tiler/tcm/tcm_rr.c
diff --git a/drivers/media/video/tiler/tcm/tcm_utils.c b/drivers/media/video/tiler/tcm/tcm_utils.c
deleted file mode 100644
index 711f36d3f6bd..000000000000
--- a/drivers/media/video/tiler/tcm/tcm_utils.c
+++ /dev/null
@@ -1,183 +0,0 @@
-#include <linux/init.h>
-#include <linux/module.h>
-
-#include "tcm_utils.h"
-#include "tcm_dbg.h"
-
-/*
-* Assignment Utility Function
-*/
-void assign(IN struct tcm_area *a, IN u16 x0, IN u16 y0, IN u16 x1, IN u16 y1)
-{
- a->p0.x = x0;
- a->p0.y = y0;
- a->p1.x = x1;
- a->p1.y = y1;
-
-}
-
-void dump_area(struct tcm_area *area)
-{
- printk(KERN_NOTICE "(%d %d) - (%d %d)\n", area->p0.x,
- area->p0.y, area->p1.x, area->p1.y);
-}
-
-
-/*
- * Inserts a given area at the end of a given list
- */
-s32 insert_element(INOUT struct area_spec_list **list,
- IN struct tcm_area *newArea, IN u16 area_type)
-{
- struct area_spec_list *list_iter = *list;
- struct area_spec_list *new_elem = NULL;
- if (list_iter == NULL) {
- list_iter = kmalloc(sizeof(struct area_spec_list), GFP_KERNEL);
- /* P("Created new List: 0x%x\n",list_iter); */
- assign(&list_iter->area, newArea->p0.x, newArea->p0.y,
- newArea->p1.x, newArea->p1.y);
- list_iter->area.tcm = newArea->tcm;
- list_iter->area.type = newArea->type;
- list_iter->area_type = area_type;
- list_iter->next = NULL;
- *list = list_iter;
- return TilerErrorNone;
- }
-
- /* move till you find the last element */
- while (list_iter->next != NULL)
- list_iter = list_iter->next;
-
- /* now we are the last one */
- /* P("Adding to the end of list\n"); */
- /*To Do: Check for malloc failures */
- new_elem = kmalloc(sizeof(struct area_spec_list), GFP_KERNEL);
- assign(&new_elem->area, newArea->p0.x, newArea->p0.y, newArea->p1.x,
- newArea->p1.y);
- new_elem->area.tcm = newArea->tcm;
- new_elem->area.type = newArea->type;
- new_elem->area_type = area_type;
- new_elem->next = NULL;
- list_iter->next = new_elem;
- return TilerErrorNone;
-}
-
-s32 rem_element_with_match(struct area_spec_list **listHead,
- struct tcm_area *to_be_removed, u16 *area_type)
-{
- struct area_spec_list *temp_list = NULL;
- struct area_spec_list *matched_elem = NULL;
- struct tcm_area *cur_area = NULL;
- u8 found_flag = NO;
-
- /*If the area to be removed matchs the list head itself,
- we need to put the next one as list head */
- if (*listHead != NULL) {
- cur_area = &(*listHead)->area;
- if (cur_area->p0.x == to_be_removed->p0.x && cur_area->p0.y ==
- to_be_removed->p0.y && cur_area->p1.x ==
- to_be_removed->p1.x && cur_area->p1.y ==
- to_be_removed->p1.y) {
- *area_type = (*listHead)->area_type;
- P1("Match found, Now Removing Area : %s\n",
- AREA_STR(a_str, cur_area));
-
- temp_list = (*listHead)->next;
- kfree(*listHead);
- *listHead = temp_list;
- return TilerErrorNone;
- }
- }
-
- temp_list = *listHead;
- while (temp_list != NULL) {
- /* we have already checked the list head,
- we check for the second in list */
- if (temp_list->next != NULL) {
- cur_area = &temp_list->next->area;
- if (cur_area->p0.x == to_be_removed->p0.x
- && cur_area->p0.y == to_be_removed->p0.y
- && cur_area->p1.x == to_be_removed->p1.x
- && cur_area->p1.y == to_be_removed->p1.y) {
- P1("Match found, Now Removing Area : %s\n",
- AREA_STR(a_str, cur_area));
- matched_elem = temp_list->next;
- *area_type = matched_elem->area_type;
- temp_list->next = matched_elem->next;
- kfree(matched_elem);
- matched_elem = NULL;
- found_flag = YES;
- break;
- }
- }
- temp_list = temp_list->next;
- }
-
- if (found_flag)
- return TilerErrorNone;
-
- PE("Match Not found :%s\n", AREA_STR(a_str, to_be_removed));
-
- return TilerErrorMatchNotFound;
-}
-
-s32 clean_list(struct area_spec_list **list)
-{
- struct area_spec_list *temp_list = NULL;
- struct area_spec_list *to_be_rem_elem = NULL;
-
- if (*list != NULL) {
- temp_list = (*list)->next;
- while (temp_list != NULL) {
- /*P("Freeing :");
- dump_area(&temp_list->area);*/
- to_be_rem_elem = temp_list->next;
- kfree(temp_list);
- temp_list = to_be_rem_elem;
- }
-
- /* freeing the head now */
- kfree(*list);
- *list = NULL;
- }
-
- return TilerErrorNone;
-}
-
-s32 dump_list_entries(IN struct area_spec_list *list)
-{
- struct area_spec_list *list_iter = NULL;
- char a_str[32] = {'\0'};
- P("Printing List Entries:\n");
-
- if (list == NULL) {
- PE("NULL List found\n");
- return TilerErrorInvalidArg;
- }
-
- /*Now if we have a valid list, let us print the values */
- list_iter = list;
- do {
- printk(KERN_NOTICE "%dD:%s\n", list_iter->area_type,
- AREA_STR(a_str, &list_iter->area));
- /* dump_area(&list_iter->area); */
- list_iter = list_iter->next;
- } while (list_iter != NULL);
-
- return TilerErrorNone;
-}
-
-
-
-s32 dump_neigh_stats(struct neighbour_stats *neighbour)
-{
- P("Top Occ:Boundary %d:%d\n", neighbour->top_occupied,
- neighbour->top_boundary);
- P("Bot Occ:Boundary %d:%d\n", neighbour->bottom_occupied,
- neighbour->bottom_boundary);
- P("Left Occ:Boundary %d:%d\n", neighbour->left_occupied,
- neighbour->left_boundary);
- P("Rigt Occ:Boundary %d:%d\n", neighbour->right_occupied,
- neighbour->right_boundary);
- return TilerErrorNone;
-}
diff --git a/drivers/media/video/tiler/tcm/tcm_utils.h b/drivers/media/video/tiler/tcm/tcm_utils.h
index 294239910b29..711f36d3f6bd 100644
--- a/drivers/media/video/tiler/tcm/tcm_utils.h
+++ b/drivers/media/video/tiler/tcm/tcm_utils.h
@@ -1,25 +1,183 @@
-#ifndef _TILER_UTILS_H
-#define _TILER_UTILS_H
+#include <linux/init.h>
+#include <linux/module.h>
-#include "tcm_rr.h"
+#include "tcm_utils.h"
#include "tcm_dbg.h"
-#define AREA_STR(a_str, area) ({ \
- sprintf(a_str, "(%03d %03d)-(%03d %03d)", (area)->p0.x, (area)->p0.y, \
- (area)->p1.x, (area)->p1.y); a_str; })
+/*
+* Assignment Utility Function
+*/
+void assign(IN struct tcm_area *a, IN u16 x0, IN u16 y0, IN u16 x1, IN u16 y1)
+{
+ a->p0.x = x0;
+ a->p0.y = y0;
+ a->p1.x = x1;
+ a->p1.y = y1;
-void assign(struct tcm_area *a, u16 x0, u16 y0, u16 x1, u16 y1);
-void dump_area(struct tcm_area *area);
+}
+void dump_area(struct tcm_area *area)
+{
+ printk(KERN_NOTICE "(%d %d) - (%d %d)\n", area->p0.x,
+ area->p0.y, area->p1.x, area->p1.y);
+}
+
+
+/*
+ * Inserts a given area at the end of a given list
+ */
s32 insert_element(INOUT struct area_spec_list **list,
- IN struct tcm_area *newArea, IN u16 area_type);
+ IN struct tcm_area *newArea, IN u16 area_type)
+{
+ struct area_spec_list *list_iter = *list;
+ struct area_spec_list *new_elem = NULL;
+ if (list_iter == NULL) {
+ list_iter = kmalloc(sizeof(struct area_spec_list), GFP_KERNEL);
+ /* P("Created new List: 0x%x\n",list_iter); */
+ assign(&list_iter->area, newArea->p0.x, newArea->p0.y,
+ newArea->p1.x, newArea->p1.y);
+ list_iter->area.tcm = newArea->tcm;
+ list_iter->area.type = newArea->type;
+ list_iter->area_type = area_type;
+ list_iter->next = NULL;
+ *list = list_iter;
+ return TilerErrorNone;
+ }
+
+ /* move till you find the last element */
+ while (list_iter->next != NULL)
+ list_iter = list_iter->next;
+
+ /* now we are the last one */
+ /* P("Adding to the end of list\n"); */
+ /*To Do: Check for malloc failures */
+ new_elem = kmalloc(sizeof(struct area_spec_list), GFP_KERNEL);
+ assign(&new_elem->area, newArea->p0.x, newArea->p0.y, newArea->p1.x,
+ newArea->p1.y);
+ new_elem->area.tcm = newArea->tcm;
+ new_elem->area.type = newArea->type;
+ new_elem->area_type = area_type;
+ new_elem->next = NULL;
+ list_iter->next = new_elem;
+ return TilerErrorNone;
+}
+
+s32 rem_element_with_match(struct area_spec_list **listHead,
+ struct tcm_area *to_be_removed, u16 *area_type)
+{
+ struct area_spec_list *temp_list = NULL;
+ struct area_spec_list *matched_elem = NULL;
+ struct tcm_area *cur_area = NULL;
+ u8 found_flag = NO;
+
+ /*If the area to be removed matchs the list head itself,
+ we need to put the next one as list head */
+ if (*listHead != NULL) {
+ cur_area = &(*listHead)->area;
+ if (cur_area->p0.x == to_be_removed->p0.x && cur_area->p0.y ==
+ to_be_removed->p0.y && cur_area->p1.x ==
+ to_be_removed->p1.x && cur_area->p1.y ==
+ to_be_removed->p1.y) {
+ *area_type = (*listHead)->area_type;
+ P1("Match found, Now Removing Area : %s\n",
+ AREA_STR(a_str, cur_area));
+
+ temp_list = (*listHead)->next;
+ kfree(*listHead);
+ *listHead = temp_list;
+ return TilerErrorNone;
+ }
+ }
+
+ temp_list = *listHead;
+ while (temp_list != NULL) {
+ /* we have already checked the list head,
+ we check for the second in list */
+ if (temp_list->next != NULL) {
+ cur_area = &temp_list->next->area;
+ if (cur_area->p0.x == to_be_removed->p0.x
+ && cur_area->p0.y == to_be_removed->p0.y
+ && cur_area->p1.x == to_be_removed->p1.x
+ && cur_area->p1.y == to_be_removed->p1.y) {
+ P1("Match found, Now Removing Area : %s\n",
+ AREA_STR(a_str, cur_area));
+ matched_elem = temp_list->next;
+ *area_type = matched_elem->area_type;
+ temp_list->next = matched_elem->next;
+ kfree(matched_elem);
+ matched_elem = NULL;
+ found_flag = YES;
+ break;
+ }
+ }
+ temp_list = temp_list->next;
+ }
+
+ if (found_flag)
+ return TilerErrorNone;
+
+ PE("Match Not found :%s\n", AREA_STR(a_str, to_be_removed));
+
+ return TilerErrorMatchNotFound;
+}
+
+s32 clean_list(struct area_spec_list **list)
+{
+ struct area_spec_list *temp_list = NULL;
+ struct area_spec_list *to_be_rem_elem = NULL;
+
+ if (*list != NULL) {
+ temp_list = (*list)->next;
+ while (temp_list != NULL) {
+ /*P("Freeing :");
+ dump_area(&temp_list->area);*/
+ to_be_rem_elem = temp_list->next;
+ kfree(temp_list);
+ temp_list = to_be_rem_elem;
+ }
+
+ /* freeing the head now */
+ kfree(*list);
+ *list = NULL;
+ }
+
+ return TilerErrorNone;
+}
+
+s32 dump_list_entries(IN struct area_spec_list *list)
+{
+ struct area_spec_list *list_iter = NULL;
+ char a_str[32] = {'\0'};
+ P("Printing List Entries:\n");
+
+ if (list == NULL) {
+ PE("NULL List found\n");
+ return TilerErrorInvalidArg;
+ }
+
+ /*Now if we have a valid list, let us print the values */
+ list_iter = list;
+ do {
+ printk(KERN_NOTICE "%dD:%s\n", list_iter->area_type,
+ AREA_STR(a_str, &list_iter->area));
+ /* dump_area(&list_iter->area); */
+ list_iter = list_iter->next;
+ } while (list_iter != NULL);
-s32 dump_list_entries(IN struct area_spec_list *list);
+ return TilerErrorNone;
+}
-s32 dump_neigh_stats(struct neighbour_stats *neighbour);
-s32 rem_element_with_match(struct area_spec_list **list,
- struct tcm_area *to_be_removed, u16 *area_type);
-s32 clean_list(struct area_spec_list **list);
-#endif
+s32 dump_neigh_stats(struct neighbour_stats *neighbour)
+{
+ P("Top Occ:Boundary %d:%d\n", neighbour->top_occupied,
+ neighbour->top_boundary);
+ P("Bot Occ:Boundary %d:%d\n", neighbour->bottom_occupied,
+ neighbour->bottom_boundary);
+ P("Left Occ:Boundary %d:%d\n", neighbour->left_occupied,
+ neighbour->left_boundary);
+ P("Rigt Occ:Boundary %d:%d\n", neighbour->right_occupied,
+ neighbour->right_boundary);
+ return TilerErrorNone;
+}