Abandon attempt to get common data structures for NX and the raw framebuffer cursor interface. This backs out several changes.

This commit is contained in:
Gregory Nutt 2019-04-07 18:00:40 -06:00
parent e5c56aaab6
commit 2c2729521b
12 changed files with 95 additions and 157 deletions

View File

@ -160,12 +160,12 @@ static const struct fb_planeinfo_s g_planeinfo =
/* Current cursor position */
#ifdef CONFIG_FB_HWCURSOR
static struct cursor_pos_s g_cpos;
static struct fb_cursorpos_s g_cpos;
/* Current cursor size */
#ifdef CONFIG_FB_HWCURSORSIZE
static struct cursor_size_s g_csize;
static struct fb_cursorsize_s g_csize;
#endif
#endif

View File

@ -147,12 +147,12 @@ static const struct fb_planeinfo_s g_planeinfo =
/* Current cursor position */
#ifdef CONFIG_FB_HWCURSOR
static struct cursor_pos_s g_cpos;
static struct fb_cursorpos_s g_cpos;
/* Current cursor size */
#ifdef CONFIG_FB_HWCURSORSIZE
static struct cursor_size_s g_csize;
static struct fb_cursorsize_s g_csize;
#endif
#endif

View File

@ -645,9 +645,9 @@ struct sam_lcdc_s
struct sam_layer_s layer[LCDC_NLAYERS];
#ifdef CONFIG_FB_HWCURSOR
struct cursor_pos_s cpos; /* Current cursor position */
struct fb_cursorpos_s cpos; /* Current cursor position */
#ifdef CONFIG_FB_HWCURSORSIZE
struct cursor_size_s csize; /* Current cursor size */
struct fb_cursorsize_s csize; /* Current cursor size */
#endif
#endif

View File

@ -152,12 +152,12 @@ static struct fb_planeinfo_s g_planeinfo;
/* Current cursor position */
#ifdef CONFIG_FB_HWCURSOR
static struct cursor_pos_s g_cpos;
static struct fb_cursorpos_s g_cpos;
/* Current cursor size */
#ifdef CONFIG_FB_HWCURSORSIZE
static struct cursor_size_s g_csize;
static struct fb_cursorsize_s g_csize;
#endif
#endif

View File

@ -196,7 +196,7 @@ struct nxbe_cursor_s
struct nxbe_cursor_s
{
bool visible; /* True: the cursor is visible */
struct cursor_pos_s pos; /* The current cursor position */
struct nxgl_point_s pos; /* The current cursor position */
};
#endif
@ -321,7 +321,7 @@ void nxbe_cursor_enable(FAR struct nxbe_state_s *be, bool enable);
#if defined(CONFIG_NX_HWCURSORIMAGE) || defined(CONFIG_NX_SWCURSOR)
void nxbe_cursor_setimage(FAR struct nxbe_state_s *be,
FAR struct cursor_image_s *image);
FAR struct nx_cursorimage_s *image);
#endif
/****************************************************************************
@ -340,7 +340,7 @@ void nxbe_cursor_setimage(FAR struct nxbe_state_s *be,
****************************************************************************/
void nxcursor_setposition(FAR struct nxbe_state_s *be,
FAR const struct cursor_pos_s *pos);
FAR const struct nxgl_point_s *pos);
#endif /* CONFIG_NX_SWCURSOR || CONFIG_NX_HWCURSOR */
/****************************************************************************

View File

@ -300,7 +300,7 @@ void nxbe_cursor_enable(FAR struct nxbe_state_s *be, bool enable)
#if defined(CONFIG_NX_HWCURSORIMAGE) || defined(CONFIG_NX_SWCURSOR)
void nxbe_cursor_setimage(FAR struct nxbe_state_s *be,
FAR struct cursor_image_s *image);
FAR struct nx_cursorimage_s *image);
{
#warning Missing logic
}
@ -322,7 +322,7 @@ void nxbe_cursor_setimage(FAR struct nxbe_state_s *be,
****************************************************************************/
void nxcursor_setposition(FAR struct nxbe_state_s *be,
FAR const struct cursor_pos_s *pos)
FAR const struct nxgl_point_s *pos)
{
#warning Missing logic
}

View File

@ -132,12 +132,12 @@ static int up_setcursor(FAR struct fb_vtable_s *vtable,
/* Current cursor position */
#ifdef CONFIG_FB_HWCURSOR
static struct cursor_pos_s g_cpos;
static struct fb_cursorpos_s g_cpos;
/* Current cursor size */
#ifdef CONFIG_FB_HWCURSORSIZE
static struct cursor_size_s g_csize;
static struct fb_cursorsize_s g_csize;
#endif
#endif

View File

@ -46,7 +46,7 @@
#include <stdint.h>
#include <stdbool.h>
#include <nuttx/video/cursor.h>
#include <nuttx/nx/nxtypes.h>
#ifndef defined(CONFIG_NX_SWCURSOR) || defined(CONFIG_NX_HWCURSOR)
@ -59,6 +59,31 @@ extern "C"
#define EXTERN extern
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
/* For cursor controllers that support custem cursor images, this structure
* is used to provide the cursor image.
*
* The image is provided a a 2-bits-per-pixel image. The two bit incoding
* is as followings:
*
* 00 - The transparent background
* 01 - Color1: The main color of the cursor
* 10 - Color2: The color of any border
* 11 - Color3: A blend color for better imaging (fake anti-aliasing).
*/
struct nx_cursorimage_s
{
struct nxgl_size_s size; /* The size of the cursor image */
nxgl_mxpixel_t color1[CONFIG_NX_NPLANES]; /* Color1 is main color of the cursor */
nxgl_mxpixel_t color2[CONFIG_NX_NPLANES]; /* Color2 is color of any border */
nxgl_mxpixel_t color3[CONFIG_NX_NPLANES]; /* Color3 is the blended color */
FAR const uint8_t *image; /* Pointer to bitmap image data */
};
/****************************************************************************
* Public Functions
****************************************************************************/
@ -108,7 +133,7 @@ int nxcursor_enable(NXHANDLE hnd, bool enable);
****************************************************************************/
#if defined(CONFIG_NX_HWCURSORIMAGE) || defined(CONFIG_NX_SWCURSOR)
int nxcursor_setimage(NXHANDLE hnd, FAR struct cursor_image_s *image);
int nxcursor_setimage(NXHANDLE hnd, FAR struct nx_cursorimage_s *image);
#endif
/****************************************************************************
@ -126,7 +151,7 @@ int nxcursor_setimage(NXHANDLE hnd, FAR struct cursor_image_s *image);
*
****************************************************************************/
int nxcursor_setposition(NXHANDLE hnd, FAR const struct cursor_pos_s *pos);
int nxcursor_setposition(NXHANDLE hnd, FAR const struct nxgl_point_s *pos);
/****************************************************************************
* Name: nxcursor_get_position
@ -148,7 +173,7 @@ int nxcursor_setposition(NXHANDLE hnd, FAR const struct cursor_pos_s *pos);
*
****************************************************************************/
int nxcursor_get_position(NXHANDLE hnd, FAR struct cursor_pos_s *pos);
int nxcursor_get_position(NXHANDLE hnd, FAR struct nxgl_point_s *pos);
#undef EXTERN
#if defined(__cplusplus)

View File

@ -49,6 +49,7 @@
#include <nuttx/semaphore.h>
#include <nuttx/nx/nx.h>
#include <nuttx/nx/nxcursor.h>
/****************************************************************************
* Pre-processor Definitions
@ -312,8 +313,8 @@ struct nxsvrmsg_curenable_s
struct nxsvrmsg_curimage_s
{
uint32_t msgid; /* NX_SVRMSG_CURSOR_IMAGE */
FAR struct cursor_image_s image /* Describes the cursor image */
uint32_t msgid; /* NX_SVRMSG_CURSOR_IMAGE */
FAR struct nx_cursorimage_s image /* Describes the cursor image */
};
#endif
@ -321,8 +322,8 @@ struct nxsvrmsg_curimage_s
struct nxsvrmsg_curpos_s
{
uint32_t msgid; /* NX_SVRMSG_CURSOR_SETPOS */
FAR struct cursor_pos_s pos; /* The new cursor position */
uint32_t msgid; /* NX_SVRMSG_CURSOR_SETPOS */
FAR struct nxgl_point_s pos; /* The new cursor position */
};
#endif

View File

@ -1,120 +0,0 @@
/****************************************************************************
* include/nuttx/video/cursor.h
*
* Copyright (C) 2008-2011, 2013, 2016-2019 Gregory Nutt. All rights
* reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
#ifndef __INCLUDE_NUTTX_VIDEO_CURSOR_H
#define __INCLUDE_NUTTX_VIDEO_CURSOR_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#ifdef CONFIG_NX
# include <nuttx/nx/nxtypes.h>
#else
# include <nuttx/video/fb.h>
#endif
/****************************************************************************
* Pre-processor definitions
****************************************************************************/
/****************************************************************************
* Public Types
****************************************************************************/
#ifdef CONFIG_NX
/* If NX is defined, make types agree with NX */
typedef nxgl_coord_t cursor_coord_t;
typedef nxgl_mxpixel_t cursor_color_t[CONFIG_NX_NPLANES];
#else
/* Otherwise use framebuffer and worst case types */
typedef fb_coord_t cursor_coord_t;
typedef uint32_t cursor_color_t;
#endif
/* For cursor controllers that support custem cursor images, this structure
* is used to provide the cursor image.
*
* The image is provided a a 2-bits-per-pixel image. The two bit incoding
* is as followings:
*
* 00 - The transparent background
* 01 - Color1: The main color of the cursor
* 10 - Color2: The color of any border
* 11 - Color3: A blend color for better imaging (fake anti-aliasing).
*/
struct cursor_image_s
{
cursor_coord_t width; /* Width of the cursor image in pixels */
cursor_coord_t height; /* Height of the cursor image in pixels */
cursor_color_t color1; /* Color1 is main color of the cursor */
cursor_color_t color2; /* Color2 is color of any border */
cursor_color_t color3; /* Color3 is the blended color */
FAR const uint8_t *image; /* Pointer to bitmap image data */
};
/* The following structure defines the cursor position. If CONFIG_NX=y,
* this structure is equivalent to struct nxgl_pos_s.
*/
struct cursor_pos_s
{
cursor_coord_t x; /* X position in pixels */
cursor_coord_t y; /* Y position in rows */
};
/* If the hardware supports setting the cursor size, then this structure
* is used to provide the cursor size. If CONFIG_NX=y, this structure is
* equivalent to struct nxgl_size_s.
*/
struct cursor_size_s
{
cursor_coord_t h; /* Height in rows */
cursor_coord_t w; /* Width in pixels */
};
#endif /* __INCLUDE_NUTTX_VIDEO_CURSOR_H */

View File

@ -47,7 +47,6 @@
#include <stdint.h>
#include <nuttx/fs/ioctl.h>
#include <nuttx/video/cursor.h>
/****************************************************************************
* Pre-processor definitions
@ -412,6 +411,40 @@ struct fb_cmap_s
#endif
#ifdef CONFIG_FB_HWCURSOR
#ifdef CONFIG_FB_HWCURSORIMAGE
/* If the video controller hardware supports a hardware cursor and
* that hardware cursor supports user-provided images, then the
* following structure may be used to provide the cursor image
*/
struct fb_cursorimage_s
{
fb_coord_t width; /* Width of the cursor image in pixels */
fb_coord_t height /* Height of the cursor image in pixels */
const uint8_t *image; /* Pointer to image data */
};
#endif
/* The following structure defines the cursor position/size */
struct fb_cursorpos_s
{
fb_coord_t x; /* X position in pixels */
fb_coord_t y; /* Y position in rows */
};
/* If the hardware supports setting the cursor size, then this structure
* is used to provide the size.
*/
#ifdef CONFIG_FB_HWCURSORSIZE
struct fb_cursorsize_s
{
fb_coord_t h; /* Height in rows */
fb_coord_t w; /* Width in pixels */
};
#endif
/* The following are used to get/get the cursor attributes via IOCTL command. */
struct fb_cursorattrib_s
@ -419,22 +452,22 @@ struct fb_cursorattrib_s
#ifdef CONFIG_FB_HWCURSORIMAGE
uint8_t fmt; /* Video format of cursor */
#endif
struct cursor_pos_s pos; /* Current cursor position */
struct fb_cursorpos_s pos; /* Current cursor position */
#ifdef CONFIG_FB_HWCURSORSIZE
struct cursor_size_s mxsize; /* Maximum cursor size */
struct cursor_size_s size; /* Current size */
struct fb_cursorsize_s mxsize; /* Maximum cursor size */
struct fb_cursorsize_s size; /* Current size */
#endif
};
struct fb_setcursor_s
{
uint8_t flags; /* See FB_CUR_* definitions */
struct cursor_pos_s pos; /* Cursor position */
uint8_t flags; /* See FB_CUR_* definitions */
struct fb_cursorpos_s pos; /* Cursor position */
#ifdef CONFIG_FB_HWCURSORSIZE
struct cursor_size_s size; /* Cursor size */
struct fb_cursorsize_s size; /* Cursor size */
#endif
#ifdef CONFIG_FB_HWCURSORIMAGE
struct cursor_image_s img; /* Cursor image */
struct fb_cursorimage_s img; /* Cursor image */
#endif
};
#endif

View File

@ -42,7 +42,6 @@
#include <sys/types.h>
#include <errno.h>
#include <nuttx/video/cursor.h>
#include <nuttx/nx/nxcursor.h>
#ifndef defined(CONFIG_NX_SWCURSOR) || defined(CONFIG_NX_HWCURSOR)
@ -116,7 +115,7 @@ int nxcursor_enable(NXHANDLE hnd, bool enable)
****************************************************************************/
#if defined(CONFIG_NX_HWCURSORIMAGE) || defined(CONFIG_NX_SWCURSOR)
int nxcursor_setimage(NXHANDLE hnd, FAR struct cursor_image_s *image)
int nxcursor_setimage(NXHANDLE hnd, FAR struct nx_cursorimage_s *image)
{
FAR struct nxmu_conn_s *conn = (FAR struct nxmu_conn_s *)handle;
struct nxsvrmsg_curimage_s outmsg;
@ -127,8 +126,8 @@ int nxcursor_setimage(NXHANDLE hnd, FAR struct cursor_image_s *image)
/* Send the new cursor image to the server */
outmsg.msgid = NX_SVRMSG_CURSOR_IMAGE;
outmsg.image.width = image->width;
outmsg.image.height = image->height;
outmsg.image.size.x = image->size.x;
outmsg.image.size.y = image->size.y;
outmsg.image.color1 = image->color1;
outmsg.image.color2 = image->color2;
outmsg.image.color3 = image->color3;
@ -163,7 +162,7 @@ int nxcursor_setimage(NXHANDLE hnd, FAR struct cursor_image_s *image)
*
****************************************************************************/
int nxcursor_setposition(NXHANDLE hnd, FAR const struct cursor_pos_s *pos)
int nxcursor_setposition(NXHANDLE hnd, FAR const struct nxgl_point_s *pos)
{
FAR struct nxmu_conn_s *conn = (FAR struct nxmu_conn_s *)handle;
struct nxsvrmsg_curpos_s outmsg;
@ -210,7 +209,7 @@ int nxcursor_setposition(NXHANDLE hnd, FAR const struct cursor_pos_s *pos)
*
****************************************************************************/
int nxcursor_get_position(NXHANDLE hnd, FAR struct cursor_pos_s *pos)
int nxcursor_get_position(NXHANDLE hnd, FAR struct nxgl_point_s *pos)
{
/* REVISIT: The cursor position is not accessible from here. It is in hnd,
* be we don't have the definitions exposed to get it.