[PATCH] sunxi: disp_ump: Introduce a new ioctl for UMP wrapping the whole framebuffer

301 views
Skip to first unread message

Siarhei Siamashka

unread,
Jan 11, 2013, 3:50:55 AM1/11/13
to linux...@googlegroups.com, Siarhei Siamashka
There are two ioctls (GET_UMP_SECURE_ID_BUF1 and GET_UMP_SECURE_ID_BUF2)
available for similar purpose already. And they are used by xf86-video-mali
X11 DDX driver.

In order not to clash with them, we just can add a new ioctl. This ioctl is
needed for the new, soon to be announced xf86-video-sunxifb X11 DDX driver.

Signed-off-by: Siarhei Siamashka <siarhei....@gmail.com>
---
drivers/video/sunxi/disp/dev_fb.c | 6 ++++--
drivers/video/sunxi/disp/dev_fb.h | 2 +-
drivers/video/sunxi/disp/disp_ump.c | 9 ++++++---
include/video/sunxi_disp_ioctl.h | 2 ++
4 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/drivers/video/sunxi/disp/dev_fb.c b/drivers/video/sunxi/disp/dev_fb.c
index a40286e..e06910a 100644
--- a/drivers/video/sunxi/disp/dev_fb.c
+++ b/drivers/video/sunxi/disp/dev_fb.c
@@ -1364,8 +1364,10 @@ static int Fb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)

#ifdef CONFIG_FB_SUNXI_UMP
case GET_UMP_SECURE_ID_BUF2: /* flow trough */
- secure_id_buf_num = 1;
- case GET_UMP_SECURE_ID_BUF1:
+ secure_id_buf_num++;
+ case GET_UMP_SECURE_ID_BUF1: /* flow trough */
+ secure_id_buf_num++;
+ case GET_UMP_SECURE_ID_SUNXI_FB:
{
if (!disp_get_ump_secure_id)
request_module("disp_ump");
diff --git a/drivers/video/sunxi/disp/dev_fb.h b/drivers/video/sunxi/disp/dev_fb.h
index 84e76ab..13e6f71 100644
--- a/drivers/video/sunxi/disp/dev_fb.h
+++ b/drivers/video/sunxi/disp/dev_fb.h
@@ -57,7 +57,7 @@ typedef struct {
unsigned long wait_count[SUNXI_MAX_FB];
__u32 pseudo_palette[SUNXI_MAX_FB][16];
#ifdef CONFIG_FB_SUNXI_UMP
- ump_dd_handle ump_wrapped_buffer[SUNXI_MAX_FB][2];
+ ump_dd_handle ump_wrapped_buffer[SUNXI_MAX_FB][3];
#endif
/* screen_base address, allocated with disp_malloc() */
void *malloc_screen_base[SUNXI_MAX_FB];
diff --git a/drivers/video/sunxi/disp/disp_ump.c b/drivers/video/sunxi/disp/disp_ump.c
index 1efc573..a29dc55 100644
--- a/drivers/video/sunxi/disp/disp_ump.c
+++ b/drivers/video/sunxi/disp/disp_ump.c
@@ -44,9 +44,12 @@ static int _disp_get_ump_secure_id(struct fb_info *info, fb_info_t *g_fbi,
if (!g_fbi->ump_wrapped_buffer[info->node][buf]) {
ump_dd_physical_block ump_memory_description;

- ump_memory_description.addr =
- info->fix.smem_start + (buf_len * buf);
- ump_memory_description.size = buf_len;
+ ump_memory_description.addr = info->fix.smem_start;
+ ump_memory_description.size = info->fix.smem_len;
+ if (buf > 0) {
+ ump_memory_description.addr += (buf_len * (buf - 1));
+ ump_memory_description.size = buf_len;
+ }
g_fbi->ump_wrapped_buffer[info->node][buf] =
ump_dd_handle_create_from_phys_blocks
(&ump_memory_description, 1);
diff --git a/include/video/sunxi_disp_ioctl.h b/include/video/sunxi_disp_ioctl.h
index b4d1151..5ba03b2 100644
--- a/include/video/sunxi_disp_ioctl.h
+++ b/include/video/sunxi_disp_ioctl.h
@@ -863,6 +863,8 @@ typedef enum tag_DISP_CMD {
#define GET_UMP_SECURE_ID_BUF1 _IOWR('m', 310, unsigned int)
#define GET_UMP_SECURE_ID_BUF2 _IOWR('m', 311, unsigned int)

+#define GET_UMP_SECURE_ID_SUNXI_FB _IOWR('s', 100, unsigned int)
+
#define FBIOGET_LAYER_HDL_0 0x4700
#define FBIOGET_LAYER_HDL_1 0x4701

--
1.7.8.6

Jari Helaakoski

unread,
Jan 11, 2013, 3:47:25 PM1/11/13
to linux...@googlegroups.com, Siarhei Siamashka

2013/1/11 Siarhei Siamashka <siarhei....@gmail.com>

There are two ioctls (GET_UMP_SECURE_ID_BUF1 and GET_UMP_SECURE_ID_BUF2)
available for similar purpose already. And they are used by xf86-video-mali
X11 DDX driver.

In order not to clash with them, we just can add a new ioctl. This ioctl is
needed for the new, soon to be announced xf86-video-sunxifb X11 DDX driver.
Hi,

So you need pre r3p0 type ioctl. I'm wondering why ARM needs two ioctls with post r3p0 for buffer handling.
According comments from ARM they should be used with double buffering.

But since this is additional feature, I think we can add this. :)

-Jari

Alejandro Mery

unread,
Jan 11, 2013, 4:58:31 PM1/11/13
to linux...@googlegroups.com, Siarhei Siamashka
thank you. applied on both stage branches

cheers,
Alejandro Mery

Siarhei Siamashka

unread,
Jan 11, 2013, 5:17:09 PM1/11/13
to linux...@googlegroups.com
On Fri, 11 Jan 2013 22:47:25 +0200
Jari Helaakoski <tek...@gmail.com> wrote:

> 2013/1/11 Siarhei Siamashka <siarhei....@gmail.com>
>
> > There are two ioctls (GET_UMP_SECURE_ID_BUF1 and GET_UMP_SECURE_ID_BUF2)
> > available for similar purpose already. And they are used by xf86-video-mali
> > X11 DDX driver.
> >
> > In order not to clash with them, we just can add a new ioctl. This ioctl is
> > needed for the new, soon to be announced xf86-video-sunxifb X11 DDX driver.
> >
> Hi,
>
> So you need pre r3p0 type ioctl. I'm wondering why ARM needs two ioctls
> with post r3p0 for buffer handling.

I'm also wondering.

In the DRI2Buffer struct, "name" is used as UMP secure id of the buffer
and "flags" is used as the offset in this buffer. So the back and front
DRI2 buffers can share the same UMP buffer, just with different offsets.

I don't know why mali blobs want two UMP buffers. Moreover, the blobs
seem to expect that GET_UMP_SECURE_ID_BUF1 gets secure id equal to 1 and
GET_UMP_SECURE_ID_BUF2 gets secure id equal to 2. This can only happen
if these ioctls are the first things ever performing UMP buffers
allocations after the start of the system.

And the blob seems to be treating these secure ids in a special way by
attempting to perform something clever (or stupid):

[EGL-X11] [8087] DRI2 UMP ID 0x2 retrieved
[EGL-X11] [8087] DRI2 WINDOW UMP SECURE ID CHANGED (0x2 -> 0x2)
[EGL-X11] [8087] DETECTED ONLY ONE FRAMEBUFFER - FORCING A RESIZE

I don't see why it even would want to know about the framebuffer. I
would assume that it's the job of the DDX driver to allocate the buffers
in the right memory locations and use display controller for doing
vsync aware swapping of these buffers to make sure that the right one
is visible at any time. The blob is definitely not helping with this
and is just getting in the way.

> According comments from ARM they should be used with double buffering.
> http://forums.arm.com/index.php?/topic/16220-what-is-get-ump-secure-id-buf2-ioctl/
>
> But since this is additional feature, I think we can add this. :)

Yeah, I just wanted to have an UMP buffer which has nothing to do
with either GET_UMP_SECURE_ID_BUF1 or GET_UMP_SECURE_ID_BUF2.
Let the official reference xf86-video-mali driver mess up with them
as much as it likes :)

--
Best regards,
Siarhei Siamashka
Reply all
Reply to author
Forward
0 new messages