mirror of
https://github.com/VincentWei/MiniGUI.git
synced 2026-02-07 11:01:57 +08:00
copy chagnes from 5.0.0 to enhance DRM engine to support PROCS runmode
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -13734,14 +13734,18 @@ MG_EXPORT int drmGetDeviceFD (GHANDLE video);
|
||||
* THe struct type defines the DRM surface information.
|
||||
*/
|
||||
typedef struct _DrmSurfaceInfo {
|
||||
/** The prime fd of the buffer object. */
|
||||
int prime_fd;
|
||||
/** The global name of the buffer object. */
|
||||
uint32_t name;
|
||||
/** The local handle of the buffer object. */
|
||||
uint32_t handle;
|
||||
/** The buffer identifier. */
|
||||
uint32_t id;
|
||||
/** The prime fd of the buffer object. If it was no exported as a global
|
||||
buffer object, it has the value -1. */
|
||||
int prime_fd;
|
||||
/** The global name of the buffer object. It has the value 0 when it was
|
||||
not expored as global buffer object. */
|
||||
uint32_t name;
|
||||
/** The frame buffer identifier. If the buffer was not added as
|
||||
a frame buffer to the system, it has the value 0. */
|
||||
uint32_t fb_id;
|
||||
|
||||
/** The width of the surface. */
|
||||
uint32_t width;
|
||||
/** The height of the surface. */
|
||||
@@ -13751,7 +13755,9 @@ typedef struct _DrmSurfaceInfo {
|
||||
/** The DRM pixel format. */
|
||||
uint32_t drm_format;
|
||||
/** Size in bytes of the buffer object. */
|
||||
unsigned long size;
|
||||
size_t size;
|
||||
/** The offset from the buffer start to the real pixel data. */
|
||||
off_t offset;
|
||||
} DrmSurfaceInfo;
|
||||
|
||||
/**
|
||||
@@ -13773,15 +13779,24 @@ MG_EXPORT BOOL drmGetSurfaceInfo (GHANDLE video, HDC hdc, DrmSurfaceInfo* info);
|
||||
* \param video The video handle.
|
||||
* \param name The name handle of the DRM surface.
|
||||
* \param drm_format The DRM pixel format.
|
||||
* \param offset The offset from the buffer start to the real pixel data.
|
||||
* \param width The width of the DRM surface.
|
||||
* \param height The height of the DRM surface.
|
||||
* \param pitch The pitch (row stride) of the DRM surface.
|
||||
*
|
||||
* \return The handle to the memory DC for success, HDC_INVALID for failure.
|
||||
*/
|
||||
MG_EXPORT HDC drmCreateDCFromName (GHANDLE video,
|
||||
uint32_t name, uint32_t drm_format,
|
||||
unsigned int width, unsigned int height, uint32_t pitch);
|
||||
MG_EXPORT HDC drmCreateDCFromNameEx (GHANDLE video,
|
||||
uint32_t name, uint32_t drm_format, off_t offset,
|
||||
uint32_t width, uint32_t height, uint32_t pitch);
|
||||
|
||||
static inline HDC drmCreateDCFromName (GHANDLE video,
|
||||
uint32_t name, uint32_t drm_format,
|
||||
uint32_t width, uint32_t height, uint32_t pitch)
|
||||
{
|
||||
return drmCreateDCFromNameEx (video,
|
||||
name, drm_format, 0, width, height, pitch);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function creates a memory DC with a DRM surface which is created by
|
||||
@@ -13791,15 +13806,24 @@ MG_EXPORT HDC drmCreateDCFromName (GHANDLE video,
|
||||
* \param prime_fd The PRIME file descriptor.
|
||||
* \param size The size of the DRM surface in bytes.
|
||||
* \param drm_format The DRM pixel format.
|
||||
* \param offset The offset from the buffer start to the real pixel data.
|
||||
* \param width The width of the DRM surface.
|
||||
* \param height The height of the DRM surface.
|
||||
* \param pitch The pitch (row stride) of the DRM surface.
|
||||
*
|
||||
* \return The handle to the memory DC for success, HDC_INVALID for failure.
|
||||
*/
|
||||
MG_EXPORT HDC drmCreateDCFromPrimeFd (GHANDLE video,
|
||||
int prime_fd, unsigned long size, uint32_t drm_format,
|
||||
unsigned int width, unsigned int height, uint32_t pitch);
|
||||
MG_EXPORT HDC drmCreateDCFromPrimeFdEx (GHANDLE video,
|
||||
int prime_fd, size_t size, uint32_t drm_format, off_t offset,
|
||||
uint32_t width, uint32_t height, uint32_t pitch);
|
||||
|
||||
static inline HDC drmCreateDCFromPrimeFd (GHANDLE video,
|
||||
int prime_fd, size_t size, uint32_t drm_format,
|
||||
uint32_t width, uint32_t height, uint32_t pitch)
|
||||
{
|
||||
return drmCreateDCFromPrimeFdEx (video,
|
||||
prime_fd, size, drm_format, 0, width, height, pitch);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function creates a memory DC with a DRM surface which is created by
|
||||
@@ -13809,15 +13833,24 @@ MG_EXPORT HDC drmCreateDCFromPrimeFd (GHANDLE video,
|
||||
* \param handle The handle of the DRM surface.
|
||||
* \param size The size of the DRM surface in bytes.
|
||||
* \param drm_format The DRM pixel format.
|
||||
* \param offset The offset from the buffer start to the real pixel data.
|
||||
* \param width The width of the DRM surface.
|
||||
* \param height The height of the DRM surface.
|
||||
* \param pitch The pitch (row stride) of the DRM surface.
|
||||
*
|
||||
* \return The handle to the memory DC for success, HDC_INVALID for failure.
|
||||
*/
|
||||
MG_EXPORT HDC drmCreateDCFromHandle (GHANDLE video,
|
||||
uint32_t handle, unsigned long size, uint32_t drm_format,
|
||||
unsigned int width, unsigned int height, uint32_t pitch);
|
||||
MG_EXPORT HDC drmCreateDCFromHandleEx (GHANDLE video,
|
||||
uint32_t handle, size_t size, uint32_t drm_format, off_t offset,
|
||||
uint32_t width, uint32_t height, uint32_t pitch);
|
||||
|
||||
static inline HDC drmCreateDCFromHandle (GHANDLE video,
|
||||
uint32_t handle, size_t size, uint32_t drm_format,
|
||||
uint32_t width, uint32_t height, uint32_t pitch)
|
||||
{
|
||||
return drmCreateDCFromHandleEx (video,
|
||||
handle, size, drm_format, 0, width, height, pitch);
|
||||
}
|
||||
|
||||
/** @} end of gdi_drm_fns */
|
||||
|
||||
|
||||
@@ -95,12 +95,31 @@
|
||||
#define REQID_GETIMEPOS 0x0019
|
||||
#define REQID_SETIMEPOS 0x001A
|
||||
|
||||
#define REQID_COPYCURSOR 0x001B
|
||||
#define REQID_COPYCURSOR 0x001B
|
||||
|
||||
// Since 4.0.7: Authenticate client
|
||||
#define REQID_AUTHCLIENT 0x001C
|
||||
|
||||
// Since 4.0.7: Get shared surface
|
||||
#define REQID_GETSHAREDSURFACE 0x001D
|
||||
// for sharedfb schema
|
||||
#define SYSSF_REAL_SCREEN "syssf-real-screen"
|
||||
|
||||
/*
|
||||
* XXX: To fellows who need to add a new REQID, please make sure your new ID _less_ than MAX_SYS_REQID (defined in /include/minigui.h).
|
||||
* XXX: To fellows who need to add a new REQID, please make sure your
|
||||
* new ID _less_ than MAX_SYS_REQID (defined in /include/minigui.h).
|
||||
*/
|
||||
|
||||
/* Since 4.0.7 */
|
||||
typedef struct _SharedSurfInfo {
|
||||
uint32_t flags; // the flags of the surface
|
||||
uint32_t width, height;
|
||||
uint32_t pitch;
|
||||
uint32_t name; // when use flink name
|
||||
uint32_t drm_format; // DRM pixel format
|
||||
size_t size; // whole size of the surface
|
||||
off_t offset; // offset of pixel data
|
||||
} SHAREDSURFINFO;
|
||||
|
||||
typedef struct JoinLayerInfo
|
||||
{
|
||||
|
||||
@@ -757,7 +757,7 @@ extern GAL_Surface* __gal_screen;
|
||||
#define GAL_BMask(surface) (surface->format->Bmask)
|
||||
#define GAL_AMask(surface) (surface->format->Amask)
|
||||
|
||||
extern int mg_InitGAL (void);
|
||||
extern int mg_InitGAL (char* engine, char* mode);
|
||||
|
||||
/* Since 4.0.0; suspend/resume video device, for switching virtual terminals */
|
||||
extern int GAL_SuspendVideo(void);
|
||||
@@ -778,6 +778,29 @@ extern BYTE* gal_PutPixelKeyAlpha (GAL_Surface* dst,
|
||||
|
||||
#define mg_TerminateGAL GAL_VideoQuit
|
||||
|
||||
#ifdef _MGRM_PROCESSES
|
||||
/* Since 4.0.7: copy video information to the shared resource segment */
|
||||
BOOL GAL_CopyVideoInfoToSharedRes (void);
|
||||
#endif /* _MGRM_PROCESSES */
|
||||
|
||||
#ifdef _MGGAL_DRM
|
||||
/* functions implemented in DRM engine. */
|
||||
BOOL __drm_get_surface_info (GAL_Surface *surface, DrmSurfaceInfo* info);
|
||||
int __drm_auth_client (int, uint32_t);
|
||||
|
||||
GAL_Surface* __drm_create_surface_from_name (GHANDLE video,
|
||||
uint32_t name, uint32_t drm_format, uint32_t pixels_off,
|
||||
uint32_t width, uint32_t height, uint32_t pitch);
|
||||
|
||||
GAL_Surface* __drm_create_surface_from_handle (GHANDLE video,
|
||||
uint32_t handle, size_t size, uint32_t drm_format, uint32_t pixels_off,
|
||||
uint32_t width, uint32_t height, uint32_t pitch);
|
||||
|
||||
GAL_Surface* __drm_create_surface_from_prime_fd (GHANDLE video,
|
||||
int prime_fd, size_t size, uint32_t drm_format, uint32_t pixels_off,
|
||||
uint32_t width, uint32_t height, uint32_t pitch);
|
||||
#endif /* defined _MGGAL_DRM */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
@@ -88,10 +88,30 @@ inline static key_t get_sem_key_for_layers (void)
|
||||
return (key_t)(IPC_KEY_BASE + 0x03);
|
||||
}
|
||||
|
||||
/* constants for engine name and video mode */
|
||||
#define LEN_SO_NAME 127 // name length of a shared object (library)
|
||||
#define LEN_DEVICE_NAME 127
|
||||
#define LEN_EXDRIVER_NAME LEN_SO_NAME
|
||||
#define LEN_ENGINE_NAME 23
|
||||
#define LEN_VIDEO_MODE 31
|
||||
#define LEN_MTYPE_NAME 23
|
||||
#define LEN_FOURCC_FORMAT 7
|
||||
|
||||
typedef struct tagG_RES {
|
||||
int semid;
|
||||
int shmid;
|
||||
|
||||
/* information of NEWGAL engine; since 4.0.7 */
|
||||
char video_engine [LEN_ENGINE_NAME + 1];
|
||||
char video_mode [LEN_VIDEO_MODE + 1];
|
||||
char video_device [LEN_DEVICE_NAME + 1];
|
||||
int video_dpi, video_hres, video_vres, video_depth;
|
||||
Uint32 video_rmask, video_gmask, video_bmask, video_amask;
|
||||
#ifdef _MGGAL_DRM
|
||||
char video_exdriver [LEN_EXDRIVER_NAME + 1];
|
||||
Uint32 video_drm_format;
|
||||
#endif
|
||||
|
||||
int nr_layers;
|
||||
int semid_layer;
|
||||
|
||||
@@ -150,6 +170,23 @@ typedef struct tagG_RES {
|
||||
} G_RES;
|
||||
typedef G_RES* PG_RES;
|
||||
|
||||
#define SHAREDRES_VIDEO_ENGINE (((PG_RES)mgSharedRes)->video_engine)
|
||||
#define SHAREDRES_VIDEO_MODE (((PG_RES)mgSharedRes)->video_mode)
|
||||
#define SHAREDRES_VIDEO_DEVICE (((PG_RES)mgSharedRes)->video_device)
|
||||
#define SHAREDRES_VIDEO_DPI (((PG_RES)mgSharedRes)->video_dpi)
|
||||
#define SHAREDRES_VIDEO_HRES (((PG_RES)mgSharedRes)->video_hres)
|
||||
#define SHAREDRES_VIDEO_VRES (((PG_RES)mgSharedRes)->video_vres)
|
||||
#define SHAREDRES_VIDEO_DEPTH (((PG_RES)mgSharedRes)->video_depth)
|
||||
#define SHAREDRES_VIDEO_RMASK (((PG_RES)mgSharedRes)->video_rmask)
|
||||
#define SHAREDRES_VIDEO_GMASK (((PG_RES)mgSharedRes)->video_gmask)
|
||||
#define SHAREDRES_VIDEO_BMASK (((PG_RES)mgSharedRes)->video_bmask)
|
||||
#define SHAREDRES_VIDEO_AMASK (((PG_RES)mgSharedRes)->video_amask)
|
||||
|
||||
#ifdef _MGGAL_DRM
|
||||
#define SHAREDRES_VIDEO_EXDRIVER (((PG_RES)mgSharedRes)->video_exdriver)
|
||||
#define SHAREDRES_VIDEO_DRM_FORMAT (((PG_RES)mgSharedRes)->video_drm_format)
|
||||
#endif
|
||||
|
||||
#define SHAREDRES_TIMER_COUNTER (((PG_RES)mgSharedRes)->timer_counter)
|
||||
#define SHAREDRES_TICK_ON_LOCKSEM (((PG_RES)mgSharedRes)->tick_on_locksem)
|
||||
#define SHAREDRES_TIMEOUT (((PG_RES)mgSharedRes)->timeout)
|
||||
|
||||
@@ -108,6 +108,8 @@ void kernel_ShowCursorForGDI(BOOL fShow, void* pdc)
|
||||
|
||||
int InitGUI (int argc, const char* agr[])
|
||||
{
|
||||
char engine [LEN_ENGINE_NAME + 1];
|
||||
char mode [LEN_VIDEO_MODE + 1];
|
||||
int step = 1;
|
||||
|
||||
__mg_quiting_stage = _MG_QUITING_STAGE_RUNNING;
|
||||
@@ -135,7 +137,7 @@ int InitGUI (int argc, const char* agr[])
|
||||
step++;
|
||||
|
||||
/* Init GAL engine. */
|
||||
switch (mg_InitGAL ()) {
|
||||
switch (mg_InitGAL (engine, mode)) {
|
||||
case ERR_CONFIG_FILE:
|
||||
err_message (step, "Reading configuration failure!");
|
||||
return step;
|
||||
@@ -302,6 +304,8 @@ static BOOL InstallSEGVHandler (void)
|
||||
|
||||
int InitGUI (int argc, const char* agr[])
|
||||
{
|
||||
char engine [LEN_ENGINE_NAME + 1];
|
||||
char mode [LEN_VIDEO_MODE + 1];
|
||||
int step = 1;
|
||||
|
||||
__mg_quiting_stage = _MG_QUITING_STAGE_RUNNING;
|
||||
@@ -379,7 +383,7 @@ int InitGUI (int argc, const char* agr[])
|
||||
#endif
|
||||
|
||||
/* Init GAL engine. */
|
||||
switch (mg_InitGAL ()) {
|
||||
switch (mg_InitGAL (engine, mode)) {
|
||||
case ERR_CONFIG_FILE:
|
||||
err_message (step, "Reading configuration failure!");
|
||||
return step;
|
||||
@@ -444,6 +448,22 @@ int InitGUI (int argc, const char* agr[])
|
||||
}
|
||||
atexit (kernel_UnloadSharedResource);
|
||||
SHAREDRES_TERMIOS = savedtermio;
|
||||
|
||||
/* Since 4.0.7
|
||||
* Copy the video engine information to the shared resource segement
|
||||
*/
|
||||
strncpy (SHAREDRES_VIDEO_ENGINE, engine, LEN_ENGINE_NAME);
|
||||
strncpy (SHAREDRES_VIDEO_MODE, mode, LEN_VIDEO_MODE);
|
||||
SHAREDRES_VIDEO_DPI = __gal_screen->dpi;
|
||||
SHAREDRES_VIDEO_HRES = __gal_screen->w;
|
||||
SHAREDRES_VIDEO_VRES = __gal_screen->h;
|
||||
SHAREDRES_VIDEO_DEPTH = __gal_screen->format->BitsPerPixel;
|
||||
SHAREDRES_VIDEO_RMASK = __gal_screen->format->Rmask;
|
||||
SHAREDRES_VIDEO_GMASK = __gal_screen->format->Gmask;
|
||||
SHAREDRES_VIDEO_BMASK = __gal_screen->format->Bmask;
|
||||
SHAREDRES_VIDEO_AMASK = __gal_screen->format->Amask;
|
||||
|
||||
GAL_CopyVideoInfoToSharedRes();
|
||||
}
|
||||
|
||||
step++;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -15,7 +15,7 @@
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
* Copyright (C) 2019, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 2019 ~ 2020, Beijing FMSoft Technologies Co., Ltd.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -55,13 +55,18 @@
|
||||
|
||||
/* Private display data */
|
||||
|
||||
#define LEN_DEVICE_NAME 31
|
||||
|
||||
typedef struct drm_mode_info DrmModeInfo;
|
||||
|
||||
typedef struct GAL_PrivateVideoData {
|
||||
char dev_name[LEN_DEVICE_NAME + 1];
|
||||
char* dev_name;
|
||||
char* ex_driver;
|
||||
GAL_Surface* real_screen;
|
||||
int dev_fd;
|
||||
/* capabilities */
|
||||
uint32_t scanout_buff_id;
|
||||
/* the global names of real screen and shadow screen */
|
||||
uint32_t real_name;
|
||||
uint32_t cap_dumb:1;
|
||||
|
||||
void* exdrv_handle;
|
||||
DrmDriverOps* driver_ops;
|
||||
@@ -70,23 +75,8 @@ typedef struct GAL_PrivateVideoData {
|
||||
DrmModeInfo* mode_list;
|
||||
GAL_Rect** modes;
|
||||
|
||||
int bpp;
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
uint32_t pitch;
|
||||
uint32_t size;
|
||||
|
||||
uint32_t scanout_buff_id;
|
||||
uint8_t* scanout_fb;
|
||||
|
||||
DrmModeInfo* saved_info;
|
||||
drmModeCrtc* saved_crtc;
|
||||
|
||||
/* only valid when using DUMB frame buffer */
|
||||
uint32_t handle;
|
||||
|
||||
/* only valid when using DRM driver */
|
||||
uint32_t console_buff_id;
|
||||
} DrmVideoData;
|
||||
|
||||
#endif /* _NEWGAL_DRIVIDEO_H */
|
||||
|
||||
@@ -87,12 +87,10 @@ BOOL GAL_ParseVideoMode (const char* mode, int* w, int* h, int* depth)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int mg_InitGAL (void)
|
||||
int mg_InitGAL (char* engine, char* mode)
|
||||
{
|
||||
int i;
|
||||
int w, h, depth;
|
||||
char engine [LEN_ENGINE_NAME + 1];
|
||||
char mode [LEN_MODE + 1];
|
||||
|
||||
#if defined (WIN32) || !defined(__NOUNIX__)
|
||||
char* env_value;
|
||||
|
||||
@@ -102,10 +102,10 @@ struct GAL_VideoDevice {
|
||||
GAL_Surface *(*SetVideoMode)(_THIS, GAL_Surface *current,
|
||||
int width, int height, int bpp, Uint32 flags);
|
||||
|
||||
#if 0
|
||||
/* Toggle the fullscreen mode */
|
||||
int (*ToggleFullScreen)(_THIS, int on);
|
||||
|
||||
#if 0
|
||||
/* This is called after the video mode has been set, to get the
|
||||
initial mouse state. It should queue events as necessary to
|
||||
properly represent the current mouse focus and position.
|
||||
@@ -141,6 +141,8 @@ struct GAL_VideoDevice {
|
||||
GAL_VideoInfo info;
|
||||
|
||||
#ifndef _MGRM_THREADS
|
||||
/* Copy video information to shared resource segment */
|
||||
void (*CopyVideoInfoToSharedRes)(_THIS);
|
||||
/* Request a surface in video memory */
|
||||
void (*RequestHWSurface)(_THIS, const REQ_HWSURFACE* request, REP_HWSURFACE* reply);
|
||||
#endif
|
||||
|
||||
@@ -1406,3 +1406,15 @@ int GAL_SuspendVideo(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef _MGRM_PROCESSES
|
||||
BOOL GAL_CopyVideoInfoToSharedRes (void)
|
||||
{
|
||||
if (__mg_current_video && __mg_current_video->CopyVideoInfoToSharedRes) {
|
||||
__mg_current_video->CopyVideoInfoToSharedRes(__mg_current_video);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
#endif /* _MGRM_PROCESSES */
|
||||
|
||||
|
||||
@@ -3754,10 +3754,7 @@ MG_EXPORT GHANDLE GetVideoHandle (HDC hdc)
|
||||
|
||||
#ifdef _MGGAL_DRM
|
||||
|
||||
/* implemented in DRI engine. */
|
||||
BOOL __drm_get_surface_info (GAL_Surface *surface, DrmSurfaceInfo* info);
|
||||
|
||||
MG_EXPORT BOOL drmGetSurfaceInfo (GHANDLE video, HDC hdc, DrmSurfaceInfo* info)
|
||||
BOOL drmGetSurfaceInfo (GHANDLE video, HDC hdc, DrmSurfaceInfo* info)
|
||||
{
|
||||
PDC pdc = dc_HDC2PDC (hdc);
|
||||
if (pdc->surface->video != (GHANDLE)video)
|
||||
@@ -3766,14 +3763,8 @@ MG_EXPORT BOOL drmGetSurfaceInfo (GHANDLE video, HDC hdc, DrmSurfaceInfo* info)
|
||||
return __drm_get_surface_info(pdc->surface, info);
|
||||
}
|
||||
|
||||
/* implemented in DRI engine. */
|
||||
GAL_Surface* __drm_create_surface_from_name (GHANDLE video,
|
||||
uint32_t name, uint32_t drm_format,
|
||||
unsigned int width, unsigned int height, uint32_t pitch);
|
||||
|
||||
MG_EXPORT HDC drmCreateDCFromName (GHANDLE video,
|
||||
uint32_t name, uint32_t drm_format,
|
||||
unsigned int width, unsigned int height, uint32_t pitch)
|
||||
HDC drmCreateDCFromNameEx (GHANDLE video, uint32_t name, uint32_t drm_format,
|
||||
off_t offset, uint32_t width, uint32_t height, uint32_t pitch)
|
||||
{
|
||||
PDC pmem_dc = NULL;
|
||||
GAL_Surface* surface;
|
||||
@@ -3783,7 +3774,7 @@ MG_EXPORT HDC drmCreateDCFromName (GHANDLE video,
|
||||
|
||||
LOCK (&__mg_gdilock);
|
||||
surface = __drm_create_surface_from_name (video, name,
|
||||
drm_format, width, height, pitch);
|
||||
drm_format, offset, width, height, pitch);
|
||||
UNLOCK (&__mg_gdilock);
|
||||
|
||||
if (!surface) {
|
||||
@@ -3797,16 +3788,14 @@ MG_EXPORT HDC drmCreateDCFromName (GHANDLE video,
|
||||
|
||||
pmem_dc->DataType = TYPE_HDC;
|
||||
pmem_dc->DCType = TYPE_MEMDC;
|
||||
pmem_dc->inuse = TRUE;
|
||||
pmem_dc->inuse = TRUE;
|
||||
pmem_dc->surface = surface;
|
||||
|
||||
dc_InitDC (pmem_dc, HWND_DESKTOP, FALSE);
|
||||
dc_InitDC (pmem_dc, HWND_NULL, FALSE);
|
||||
|
||||
InitClipRgn (&pmem_dc->lcrgn, &__mg_FreeClipRectList);
|
||||
MAKE_REGION_INFINITE(&pmem_dc->lcrgn);
|
||||
InitClipRgn (&pmem_dc->ecrgn, &__mg_FreeClipRectList);
|
||||
pmem_dc->pGCRInfo = NULL;
|
||||
pmem_dc->oldage = 0;
|
||||
|
||||
pmem_dc->DevRC.left = 0;
|
||||
pmem_dc->DevRC.top = 0;
|
||||
@@ -3819,14 +3808,9 @@ MG_EXPORT HDC drmCreateDCFromName (GHANDLE video,
|
||||
return (HDC)pmem_dc;
|
||||
}
|
||||
|
||||
/* implemented in DRI engine. */
|
||||
GAL_Surface* __drm_create_surface_from_handle (GHANDLE video,
|
||||
uint32_t handle, unsigned long size, uint32_t drm_format,
|
||||
unsigned int width, unsigned int height, uint32_t pitch);
|
||||
|
||||
MG_EXPORT HDC drmCreateDCFromHandle (GHANDLE video,
|
||||
uint32_t handle, unsigned long size, uint32_t drm_format,
|
||||
unsigned int width, unsigned int height, uint32_t pitch)
|
||||
HDC drmCreateDCFromHandleEx (GHANDLE video, uint32_t handle, size_t size,
|
||||
uint32_t drm_format, off_t offset,
|
||||
uint32_t width, uint32_t height, uint32_t pitch)
|
||||
{
|
||||
PDC pmem_dc = NULL;
|
||||
GAL_Surface* surface;
|
||||
@@ -3836,7 +3820,7 @@ MG_EXPORT HDC drmCreateDCFromHandle (GHANDLE video,
|
||||
|
||||
LOCK (&__mg_gdilock);
|
||||
surface = __drm_create_surface_from_handle (video, handle, size,
|
||||
drm_format, width, height, pitch);
|
||||
drm_format, offset, width, height, pitch);
|
||||
UNLOCK (&__mg_gdilock);
|
||||
|
||||
if (!surface) {
|
||||
@@ -3850,16 +3834,14 @@ MG_EXPORT HDC drmCreateDCFromHandle (GHANDLE video,
|
||||
|
||||
pmem_dc->DataType = TYPE_HDC;
|
||||
pmem_dc->DCType = TYPE_MEMDC;
|
||||
pmem_dc->inuse = TRUE;
|
||||
pmem_dc->inuse = TRUE;
|
||||
pmem_dc->surface = surface;
|
||||
|
||||
dc_InitDC (pmem_dc, HWND_DESKTOP, FALSE);
|
||||
dc_InitDC (pmem_dc, HWND_NULL, FALSE);
|
||||
|
||||
InitClipRgn (&pmem_dc->lcrgn, &__mg_FreeClipRectList);
|
||||
MAKE_REGION_INFINITE(&pmem_dc->lcrgn);
|
||||
InitClipRgn (&pmem_dc->ecrgn, &__mg_FreeClipRectList);
|
||||
pmem_dc->pGCRInfo = NULL;
|
||||
pmem_dc->oldage = 0;
|
||||
|
||||
pmem_dc->DevRC.left = 0;
|
||||
pmem_dc->DevRC.top = 0;
|
||||
@@ -3872,14 +3854,9 @@ MG_EXPORT HDC drmCreateDCFromHandle (GHANDLE video,
|
||||
return (HDC)pmem_dc;
|
||||
}
|
||||
|
||||
/* implemented in DRI engine. */
|
||||
GAL_Surface* __drm_create_surface_from_prime_fd (GHANDLE video,
|
||||
int prime_fd, unsigned long size, uint32_t drm_format,
|
||||
unsigned int width, unsigned int height, uint32_t pitch);
|
||||
|
||||
MG_EXPORT HDC drmCreateDCFromPrimeFd (GHANDLE video,
|
||||
int prime_fd, unsigned long size, uint32_t drm_format,
|
||||
unsigned int width, unsigned int height, uint32_t pitch)
|
||||
HDC drmCreateDCFromPrimeFdEx (GHANDLE video, int prime_fd, size_t size,
|
||||
uint32_t drm_format, off_t offset,
|
||||
uint32_t width, uint32_t height, uint32_t pitch)
|
||||
{
|
||||
PDC pmem_dc = NULL;
|
||||
GAL_Surface* surface;
|
||||
@@ -3887,9 +3864,12 @@ MG_EXPORT HDC drmCreateDCFromPrimeFd (GHANDLE video,
|
||||
if (!(pmem_dc = malloc (sizeof(DC))))
|
||||
return HDC_INVALID;
|
||||
|
||||
if (size == 0) {
|
||||
}
|
||||
|
||||
LOCK (&__mg_gdilock);
|
||||
surface =__drm_create_surface_from_prime_fd (video, prime_fd, size,
|
||||
drm_format, width, height, pitch);
|
||||
drm_format, offset, width, height, pitch);
|
||||
UNLOCK (&__mg_gdilock);
|
||||
|
||||
if (!surface) {
|
||||
@@ -3903,16 +3883,14 @@ MG_EXPORT HDC drmCreateDCFromPrimeFd (GHANDLE video,
|
||||
|
||||
pmem_dc->DataType = TYPE_HDC;
|
||||
pmem_dc->DCType = TYPE_MEMDC;
|
||||
pmem_dc->inuse = TRUE;
|
||||
pmem_dc->inuse = TRUE;
|
||||
pmem_dc->surface = surface;
|
||||
|
||||
dc_InitDC (pmem_dc, HWND_DESKTOP, FALSE);
|
||||
dc_InitDC (pmem_dc, HWND_NULL, FALSE);
|
||||
|
||||
InitClipRgn (&pmem_dc->lcrgn, &__mg_FreeClipRectList);
|
||||
MAKE_REGION_INFINITE(&pmem_dc->lcrgn);
|
||||
InitClipRgn (&pmem_dc->ecrgn, &__mg_FreeClipRectList);
|
||||
pmem_dc->pGCRInfo = NULL;
|
||||
pmem_dc->oldage = 0;
|
||||
|
||||
pmem_dc->DevRC.left = 0;
|
||||
pmem_dc->DevRC.top = 0;
|
||||
@@ -3925,4 +3903,4 @@ MG_EXPORT HDC drmCreateDCFromPrimeFd (GHANDLE video,
|
||||
return (HDC)pmem_dc;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif /* _MGGAL_DRM */
|
||||
|
||||
@@ -601,6 +601,34 @@ static int req_hw_surface (int cli, int clifd, void* buff, size_t len)
|
||||
extern int clipboard_op (int cli, int clifd, void* buff, size_t len);
|
||||
#endif
|
||||
|
||||
static int authenticate_client (int cli, int clifd, void* buff, size_t len)
|
||||
{
|
||||
int auth_result = 1;
|
||||
|
||||
#ifdef _MGGAL_DRM
|
||||
uint32_t magic;
|
||||
extern int __drm_auth_client(int, uint32_t);
|
||||
magic = *(uint32_t*)buff;
|
||||
auth_result = __drm_auth_client (cli, magic);
|
||||
#endif
|
||||
|
||||
return ServerSendReply (clifd, &auth_result, sizeof (int));
|
||||
}
|
||||
|
||||
/* get the rendering surface */
|
||||
static int get_shared_surface (int cli, int clifd, void* buff, size_t len)
|
||||
{
|
||||
SHAREDSURFINFO info = { 0, 0 };
|
||||
|
||||
#ifdef _MGGAL_DRM
|
||||
const char* name = buff;
|
||||
extern int __drm_get_shared_screen_surface (const char*, SHAREDSURFINFO*);
|
||||
__drm_get_shared_screen_surface (name, &info);
|
||||
#endif
|
||||
|
||||
return ServerSendReply (clifd, &info, sizeof (SHAREDSURFINFO));
|
||||
}
|
||||
|
||||
static REQ_HANDLER handlers [MAX_REQID] =
|
||||
{
|
||||
load_cursor,
|
||||
@@ -646,6 +674,8 @@ static REQ_HANDLER handlers [MAX_REQID] =
|
||||
get_ime_targetinfo,
|
||||
set_ime_targetinfo,
|
||||
copy_cursor,
|
||||
authenticate_client,
|
||||
get_shared_surface,
|
||||
};
|
||||
|
||||
BOOL GUIAPI RegisterRequestHandler (int req_id, REQ_HANDLER your_handler)
|
||||
|
||||
Reference in New Issue
Block a user