From 093a6c67005148ae32a5c9e4553491b9f5c2457b Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Fri, 10 May 2024 07:40:51 +0000
Subject: [PATCH] disable kernel build waring
---
kernel/drivers/gpu/drm/rockchip/ebc-dev/bufmanage/buf_manage.c | 191 ++++++++++++++++++++---------------------------
1 files changed, 80 insertions(+), 111 deletions(-)
diff --git a/kernel/drivers/gpu/drm/rockchip/ebc-dev/bufmanage/buf_manage.c b/kernel/drivers/gpu/drm/rockchip/ebc-dev/bufmanage/buf_manage.c
index 6d83f49..a2e47b4 100644
--- a/kernel/drivers/gpu/drm/rockchip/ebc-dev/bufmanage/buf_manage.c
+++ b/kernel/drivers/gpu/drm/rockchip/ebc-dev/bufmanage/buf_manage.c
@@ -28,10 +28,8 @@
struct buf_list_s *dsp_buf_list; /* dispplay buffer list. */
int dsp_buf_list_status;
struct ebc_buf_s *osd_buf;
- struct buf_list_s *osd_buf_list; /* dispplay buffer list. */
- struct mutex osd_buf_lock;
- struct mutex dsp_buf_lock;
- struct mutex ebc_buf_lock;
+
+ struct mutex dsp_lock;
};
static struct buf_info_s ebc_buf_info;
@@ -56,83 +54,84 @@
return BUF_SUCCESS;
}
-static void do_dsp_buf_list(struct ebc_buf_s *dsp_buf)
+int ebc_remove_from_dsp_buf_list(struct ebc_buf_s *remove_buf)
{
- struct ebc_buf_s *temp_buf;
- int temp_pos;
-
- if (ebc_buf_info.dsp_buf_list->nb_elt > 0) {
- temp_pos = ebc_buf_info.dsp_buf_list->nb_elt;
- while (temp_pos) {
- temp_pos--;
- temp_buf = (struct ebc_buf_s *)buf_list_get(ebc_buf_info.dsp_buf_list, temp_pos);
- if (temp_buf->needpic) {
- continue;
- } else {
- buf_list_remove(ebc_buf_info.dsp_buf_list, temp_pos);
- ebc_buf_release(temp_buf);
- }
- }
- }
-}
-
-int ebc_add_to_dsp_buf_list(struct ebc_buf_s *dsp_buf)
-{
- mutex_lock(&ebc_buf_info.dsp_buf_lock);
+ mutex_lock(&ebc_buf_info.dsp_lock);
if (ebc_buf_info.dsp_buf_list) {
- do_dsp_buf_list(dsp_buf);
+ int pos;
- if (-1 == buf_list_add(ebc_buf_info.dsp_buf_list, (int *)dsp_buf, -1)) {
- ebc_buf_release(dsp_buf);
- mutex_unlock(&ebc_buf_info.dsp_buf_lock);
- return BUF_ERROR;
- }
-
- if (dsp_buf->status != buf_osd)
- dsp_buf->status = buf_dsp;
+ pos = buf_list_get_pos(ebc_buf_info.dsp_buf_list, (int *)remove_buf);
+ buf_list_remove(ebc_buf_info.dsp_buf_list, pos);
}
- mutex_unlock(&ebc_buf_info.dsp_buf_lock);
+ mutex_unlock(&ebc_buf_info.dsp_lock);
return BUF_SUCCESS;
}
-int ebc_add_to_osd_buf_list(struct ebc_buf_s *dsp_buf)
+int ebc_add_to_dsp_buf_list(struct ebc_buf_s *dsp_buf)
{
- int ret = BUF_SUCCESS;
+ struct ebc_buf_s *temp_buf;
+ int temp_pos;
+ int is_full_mode = 0;
- mutex_lock(&ebc_buf_info.osd_buf_lock);
- if (ebc_buf_info.osd_buf_list) {
- if (-1 == buf_list_add(ebc_buf_info.osd_buf_list, (int *)dsp_buf, -1)) {
- ebc_buf_release(dsp_buf);
- ret = BUF_ERROR;
+ mutex_lock(&ebc_buf_info.dsp_lock);
+ if (ebc_buf_info.dsp_buf_list) {
+ switch (dsp_buf->buf_mode) {
+ case EPD_DU:
+ case EPD_SUSPEND:
+ case EPD_RESUME:
+ case EPD_POWER_OFF:
+ case EPD_OVERLAY:
+ case EPD_RESET:
+ break;
+
+ default:
+ if (ebc_buf_info.dsp_buf_list->nb_elt > 1) {
+ temp_pos = ebc_buf_info.dsp_buf_list->nb_elt;
+ while (--temp_pos) {
+ temp_buf = (struct ebc_buf_s *)buf_list_get(ebc_buf_info.dsp_buf_list, temp_pos);
+ if ((temp_buf->buf_mode != EPD_FULL_GC16) &&
+ (temp_buf->buf_mode != EPD_FULL_GL16) &&
+ (temp_buf->buf_mode != EPD_FULL_GLR16) &&
+ (temp_buf->buf_mode != EPD_FULL_GLD16) &&
+ (temp_buf->buf_mode != EPD_FULL_GCC16) &&
+ (temp_buf->buf_mode != EPD_OVERLAY) &&
+ (temp_buf->buf_mode != EPD_DU) &&
+ (temp_buf->buf_mode != EPD_SUSPEND) &&
+ (temp_buf->buf_mode != EPD_RESUME) &&
+ (temp_buf->buf_mode != EPD_POWER_OFF)) {
+ buf_list_remove(ebc_buf_info.dsp_buf_list, temp_pos);
+ ebc_buf_release(temp_buf);
+ } else if ((1 == is_full_mode) &&
+ (temp_buf->buf_mode != EPD_DU) &&
+ (temp_buf->buf_mode != EPD_OVERLAY) &&
+ (temp_buf->buf_mode != EPD_SUSPEND) &&
+ (temp_buf->buf_mode != EPD_RESUME) &&
+ (temp_buf->buf_mode != EPD_POWER_OFF)) {
+ buf_list_remove(ebc_buf_info.dsp_buf_list, temp_pos);
+ ebc_buf_release(temp_buf);
+ } else {
+ is_full_mode = 1;
+ }
+ }
+ }
+ break;
+ }
+
+ dsp_buf->status = buf_dsp;
+ if (-1 == buf_list_add(ebc_buf_info.dsp_buf_list, (int *)dsp_buf, -1)) {
+ mutex_unlock(&ebc_buf_info.dsp_lock);
+ return BUF_ERROR;
}
}
- mutex_unlock(&ebc_buf_info.osd_buf_lock);
- return ret;
-}
+ mutex_unlock(&ebc_buf_info.dsp_lock);
-struct ebc_buf_s *ebc_osd_buf_get(void)
-{
- struct ebc_buf_s *buf = NULL;
-
- mutex_lock(&ebc_buf_info.osd_buf_lock);
- if (ebc_buf_info.osd_buf_list && (ebc_buf_info.osd_buf_list->nb_elt > 0)) {
- buf = (struct ebc_buf_s *)buf_list_get(ebc_buf_info.osd_buf_list, 0);
- buf_list_remove(ebc_buf_info.osd_buf_list, 0);
- }
- mutex_unlock(&ebc_buf_info.osd_buf_lock);
-
- return buf;
+ return BUF_SUCCESS;
}
int ebc_get_dsp_list_enum_num(void)
{
return ebc_buf_info.dsp_buf_list->nb_elt;
-}
-
-int ebc_get_osd_list_enum_num(void)
-{
- return ebc_buf_info.osd_buf_list->nb_elt;
}
struct ebc_buf_s *ebc_find_buf_by_phy_addr(unsigned long phy_addr)
@@ -156,17 +155,15 @@
{
struct ebc_buf_s *buf = NULL;
- mutex_lock(&ebc_buf_info.dsp_buf_lock);
- if (ebc_buf_info.dsp_buf_list && (ebc_buf_info.dsp_buf_list->nb_elt > 0)) {
+ mutex_lock(&ebc_buf_info.dsp_lock);
+ if (ebc_buf_info.dsp_buf_list && (ebc_buf_info.dsp_buf_list->nb_elt > 0))
buf = (struct ebc_buf_s *)buf_list_get(ebc_buf_info.dsp_buf_list, 0);
- buf_list_remove(ebc_buf_info.dsp_buf_list, 0);
- }
- mutex_unlock(&ebc_buf_info.dsp_buf_lock);
+ mutex_unlock(&ebc_buf_info.dsp_lock);
return buf;
}
-struct ebc_buf_s *ebc_empty_osd_buf_get(void)
+struct ebc_buf_s *ebc_osd_buf_get(void)
{
if (ebc_buf_info.osd_buf)
return ebc_buf_info.osd_buf;
@@ -188,13 +185,12 @@
return temp_buf;
}
-struct ebc_buf_s *ebc_empty_buf_get(const char *tid_name)
+struct ebc_buf_s *ebc_empty_buf_get(void)
{
- struct ebc_buf_s *temp_buf = NULL;
+ struct ebc_buf_s *temp_buf;
int temp_pos;
- mutex_lock(&ebc_buf_info.ebc_buf_lock);
- while (ebc_buf_info.buf_list) {
+ if (ebc_buf_info.buf_list) {
temp_pos = 0;
while (temp_pos < ebc_buf_info.buf_list->nb_elt) {
@@ -202,23 +198,23 @@
if (temp_buf) {
if (temp_buf->status == buf_idle) {
temp_buf->status = buf_user;
- memcpy(temp_buf->tid_name, tid_name, TASK_COMM_LEN - 1); //store user thread name
- goto OUT;
+ memcpy(temp_buf->tid_name, current->comm, TASK_COMM_LEN); //store user thread name
+ return temp_buf;
}
// one tid only can get one buf at one time
- else if ((temp_buf->status == buf_user) && (!strncmp(temp_buf->tid_name, tid_name, TASK_COMM_LEN - 1))) {
- printk("[%s]: one tid only can get one buf at one time\n", tid_name);
- goto OUT;
+ else if ((temp_buf->status == buf_user) && (!strncmp(temp_buf->tid_name, current->comm, TASK_COMM_LEN - 7))) {
+ return temp_buf;
}
}
}
ebc_buf_info.use_buf_is_empty = 1;
+
wait_event_interruptible(ebc_buf_wq, ebc_buf_info.use_buf_is_empty != 1);
+
+ return ebc_empty_buf_get();
}
-OUT:
- mutex_unlock(&ebc_buf_info.ebc_buf_lock);
- return temp_buf;
+ return NULL;
}
unsigned long ebc_phy_buf_base_get(void)
@@ -229,23 +225,6 @@
char *ebc_virt_buf_base_get(void)
{
return ebc_buf_info.virt_mem_base;
-}
-
-int ebc_buf_state_show(char *buf)
-{
- int i;
- int ret = 0;
- struct ebc_buf_s *temp_buf;
-
- ret += sprintf(buf, "dsp_buf num = %d\n", ebc_buf_info.dsp_buf_list->nb_elt);
- if (ebc_buf_info.buf_list) {
- for (i = 0; i < ebc_buf_info.buf_list->nb_elt; i++) {
- temp_buf = (struct ebc_buf_s *)buf_list_get(ebc_buf_info.buf_list, i);
- ret += sprintf(buf + ret, "ebc_buf[%d]: s = %d, m = %d, tid = %s\n", i, temp_buf->status, temp_buf->buf_mode, temp_buf->tid_name);
- }
- }
-
- return ret;
}
int ebc_buf_uninit(void)
@@ -281,21 +260,14 @@
if (NULL == mem_start)
return BUF_ERROR;
- mutex_init(&ebc_buf_info.dsp_buf_lock);
- mutex_init(&ebc_buf_info.ebc_buf_lock);
- mutex_init(&ebc_buf_info.osd_buf_lock);
+ mutex_init(&ebc_buf_info.dsp_lock);
if (buf_list_init(&ebc_buf_info.buf_list, BUF_LIST_MAX_NUMBER))
return BUF_ERROR;
if (buf_list_init(&ebc_buf_info.dsp_buf_list, BUF_LIST_MAX_NUMBER)) {
res = BUF_ERROR;
- goto dsp_list_err;
- }
-
- if (buf_list_init(&ebc_buf_info.osd_buf_list, BUF_LIST_MAX_NUMBER)) {
- res = BUF_ERROR;
- goto osd_list_err;
+ goto buf_list_err;
}
ebc_buf_info.buf_total_num = 0;
@@ -345,13 +317,10 @@
}
return BUF_SUCCESS;
-
exit:
ebc_buf_uninit();
- buf_list_uninit(ebc_buf_info.osd_buf_list);
-osd_list_err:
buf_list_uninit(ebc_buf_info.dsp_buf_list);
-dsp_list_err:
+buf_list_err:
buf_list_uninit(ebc_buf_info.buf_list);
return res;
--
Gitblit v1.6.2