gallium: delete graw
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7017 Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19099>
This commit is contained in:
@@ -1,96 +0,0 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2010 VMware, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sub license, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
||||
* IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef GALLIUM_RAW_H
|
||||
#define GALLIUM_RAW_H
|
||||
|
||||
/* This is an API for exercising gallium functionality in a
|
||||
* platform-neutral fashion. Whatever platform integration is
|
||||
* necessary to implement this interface is orchestrated by the
|
||||
* individual target building this entity.
|
||||
*
|
||||
* For instance, the graw-xlib target includes code to implement these
|
||||
* interfaces on top of the X window system.
|
||||
*
|
||||
* Programs using this interface may additionally benefit from some of
|
||||
* the utilities currently in the libgallium.a library, especially
|
||||
* those for parsing text representations of TGSI shaders.
|
||||
*/
|
||||
|
||||
#include "pipe/p_compiler.h"
|
||||
#include "pipe/p_format.h"
|
||||
|
||||
struct pipe_context;
|
||||
struct pipe_screen;
|
||||
struct pipe_surface;
|
||||
|
||||
/* Returns a handle to be used with flush_frontbuffer()/present().
|
||||
*
|
||||
* Query format support with screen::is_format_supported and usage
|
||||
* XXX.
|
||||
*/
|
||||
PUBLIC struct pipe_screen *graw_create_window_and_screen( int x,
|
||||
int y,
|
||||
unsigned width,
|
||||
unsigned height,
|
||||
enum pipe_format format,
|
||||
void **handle);
|
||||
|
||||
PUBLIC void graw_set_display_func( void (*func)( void ) );
|
||||
PUBLIC void graw_main_loop( void );
|
||||
|
||||
PUBLIC void *graw_parse_geometry_shader( struct pipe_context *pipe,
|
||||
const char *text );
|
||||
|
||||
PUBLIC void *graw_parse_vertex_shader( struct pipe_context *pipe,
|
||||
const char *text );
|
||||
|
||||
PUBLIC void *graw_parse_fragment_shader( struct pipe_context *pipe,
|
||||
const char *text );
|
||||
|
||||
/* Parse a single command-line option, if any. Options include:
|
||||
*
|
||||
* -o <filename>
|
||||
*
|
||||
* If an option has been successfully parsed, argi is updated
|
||||
* to point just after the option and return TRUE.
|
||||
*/
|
||||
PUBLIC bool graw_parse_args(int *argi, int argc, char *argv[]);
|
||||
|
||||
/* Saves surface contents to a file.
|
||||
*
|
||||
* If filename is NULL, the filename provided with the `-o' option
|
||||
* is used. If the option has not been specified, the surface
|
||||
* will not be saved.
|
||||
*
|
||||
* Returns TRUE if the surface has been saved.
|
||||
*/
|
||||
PUBLIC bool graw_save_surface_to_file(struct pipe_context *pipe,
|
||||
struct pipe_surface *surface,
|
||||
const char *filename);
|
||||
|
||||
#endif
|
||||
@@ -238,12 +238,6 @@ if with_platform_windows
|
||||
subdir('targets/libgl-gdi')
|
||||
endif
|
||||
if with_tests
|
||||
subdir('targets/graw-null')
|
||||
if with_platform_windows
|
||||
subdir('targets/graw-gdi')
|
||||
elif with_glx == 'gallium-xlib'
|
||||
subdir('targets/graw-xlib')
|
||||
endif
|
||||
subdir('tests')
|
||||
endif
|
||||
if with_swrast_vk
|
||||
|
||||
@@ -1,159 +0,0 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2010 VMware, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sub license, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
|
||||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
* USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#include "gdi/gdi_sw_winsys.h"
|
||||
#include "pipe/p_screen.h"
|
||||
#include "frontend/graw.h"
|
||||
#include "target-helpers/inline_debug_helper.h"
|
||||
#include "target-helpers/inline_sw_helper.h"
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
static LRESULT CALLBACK
|
||||
window_proc(HWND hWnd,
|
||||
UINT uMsg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
{
|
||||
switch (uMsg) {
|
||||
case WM_DESTROY:
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
|
||||
default:
|
||||
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct {
|
||||
void (* draw)(void);
|
||||
} graw;
|
||||
|
||||
struct pipe_screen *
|
||||
graw_create_window_and_screen(int x,
|
||||
int y,
|
||||
unsigned width,
|
||||
unsigned height,
|
||||
enum pipe_format format,
|
||||
void **handle)
|
||||
{
|
||||
struct sw_winsys *winsys = NULL;
|
||||
struct pipe_screen *screen = NULL;
|
||||
WNDCLASSEX wc;
|
||||
UINT style = WS_VISIBLE | WS_TILEDWINDOW;
|
||||
RECT rect;
|
||||
HWND hWnd = NULL;
|
||||
HDC hDC = NULL;
|
||||
|
||||
if (format != PIPE_FORMAT_R8G8B8A8_UNORM)
|
||||
goto fail;
|
||||
|
||||
winsys = gdi_create_sw_winsys();
|
||||
if (winsys == NULL)
|
||||
goto fail;
|
||||
|
||||
screen = sw_screen_create(winsys);
|
||||
if (screen == NULL)
|
||||
goto fail;
|
||||
|
||||
memset(&wc, 0, sizeof wc);
|
||||
wc.cbSize = sizeof wc;
|
||||
wc.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW;
|
||||
wc.lpfnWndProc = window_proc;
|
||||
wc.lpszClassName = TEXT("graw-gdi");
|
||||
wc.hInstance = GetModuleHandle(NULL);
|
||||
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
|
||||
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
|
||||
RegisterClassEx(&wc);
|
||||
|
||||
SetRect(&rect, 0, 0, width, height);
|
||||
AdjustWindowRectEx(&rect, style, FALSE, 0);
|
||||
|
||||
hWnd = CreateWindowEx(0,
|
||||
wc.lpszClassName,
|
||||
wc.lpszClassName,
|
||||
style,
|
||||
x,
|
||||
y,
|
||||
rect.right - rect.left,
|
||||
rect.bottom - rect.top,
|
||||
NULL,
|
||||
NULL,
|
||||
wc.hInstance,
|
||||
0);
|
||||
if (hWnd == NULL)
|
||||
goto fail;
|
||||
|
||||
hDC = GetDC(hWnd);
|
||||
if (hDC == NULL)
|
||||
goto fail;
|
||||
|
||||
*handle = (void *)hDC;
|
||||
|
||||
return debug_screen_wrap(screen);
|
||||
|
||||
fail:
|
||||
if (hWnd)
|
||||
DestroyWindow(hWnd);
|
||||
|
||||
if (screen)
|
||||
screen->destroy(screen);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
graw_set_display_func(void (* draw)(void))
|
||||
{
|
||||
graw.draw = draw;
|
||||
}
|
||||
|
||||
void
|
||||
graw_main_loop(void)
|
||||
{
|
||||
for (;;) {
|
||||
MSG msg;
|
||||
|
||||
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
|
||||
if (msg.message == WM_QUIT) {
|
||||
return;
|
||||
}
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
|
||||
if (graw.draw) {
|
||||
graw.draw();
|
||||
}
|
||||
|
||||
Sleep(0);
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
# Copyright © 2018-2019 Intel Corporation
|
||||
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
libgraw_gdi = shared_library(
|
||||
'graw',
|
||||
'graw_gdi.c',
|
||||
c_args : [c_msvc_compat_args],
|
||||
gnu_symbol_visibility : 'hidden',
|
||||
include_directories : [
|
||||
inc_include, inc_src, inc_gallium, inc_gallium_aux, inc_gallium_drivers,
|
||||
inc_gallium_winsys_sw,
|
||||
],
|
||||
link_with : [
|
||||
libgraw_util, libgallium, libwsgdi,
|
||||
],
|
||||
dependencies : [
|
||||
dep_ws2_32, idep_mesautil, driver_swrast, driver_d3d12
|
||||
],
|
||||
name_prefix : host_machine.system() == 'windows' ? '' : 'lib', # otherwise mingw will create libgraw.dll
|
||||
)
|
||||
|
||||
libgraw = libgraw_gdi
|
||||
@@ -1,28 +0,0 @@
|
||||
#include "frontend/graw.h"
|
||||
|
||||
|
||||
|
||||
|
||||
struct pipe_screen *
|
||||
graw_create_window_and_screen( int x,
|
||||
int y,
|
||||
unsigned width,
|
||||
unsigned height,
|
||||
enum pipe_format format,
|
||||
void **handle)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
graw_set_display_func( void (*draw)( void ) )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
graw_main_loop( void )
|
||||
{
|
||||
}
|
||||
@@ -1,97 +0,0 @@
|
||||
|
||||
#include "pipe/p_compiler.h"
|
||||
#include "pipe/p_context.h"
|
||||
#include "pipe/p_shader_tokens.h"
|
||||
#include "pipe/p_state.h"
|
||||
#include "tgsi/tgsi_text.h"
|
||||
#include "util/u_debug.h"
|
||||
#include "util/u_debug_image.h"
|
||||
#include "util/u_memory.h"
|
||||
#include "frontend/graw.h"
|
||||
|
||||
|
||||
/* Helper functions. These are the same for all graw implementations.
|
||||
*/
|
||||
PUBLIC void *
|
||||
graw_parse_geometry_shader(struct pipe_context *pipe,
|
||||
const char *text)
|
||||
{
|
||||
struct tgsi_token tokens[1024];
|
||||
struct pipe_shader_state state;
|
||||
|
||||
if (!tgsi_text_translate(text, tokens, ARRAY_SIZE(tokens)))
|
||||
return NULL;
|
||||
|
||||
memset(&state, 0, sizeof state);
|
||||
state.tokens = tokens;
|
||||
return pipe->create_gs_state(pipe, &state);
|
||||
}
|
||||
|
||||
PUBLIC void *
|
||||
graw_parse_vertex_shader(struct pipe_context *pipe,
|
||||
const char *text)
|
||||
{
|
||||
struct tgsi_token tokens[1024];
|
||||
struct pipe_shader_state state;
|
||||
|
||||
if (!tgsi_text_translate(text, tokens, ARRAY_SIZE(tokens)))
|
||||
return NULL;
|
||||
|
||||
memset(&state, 0, sizeof state);
|
||||
state.tokens = tokens;
|
||||
return pipe->create_vs_state(pipe, &state);
|
||||
}
|
||||
|
||||
PUBLIC void *
|
||||
graw_parse_fragment_shader(struct pipe_context *pipe,
|
||||
const char *text)
|
||||
{
|
||||
struct tgsi_token tokens[1024];
|
||||
struct pipe_shader_state state;
|
||||
|
||||
if (!tgsi_text_translate(text, tokens, ARRAY_SIZE(tokens)))
|
||||
return NULL;
|
||||
|
||||
memset(&state, 0, sizeof state);
|
||||
state.tokens = tokens;
|
||||
return pipe->create_fs_state(pipe, &state);
|
||||
}
|
||||
|
||||
static char out_filename[256] = "";
|
||||
|
||||
PUBLIC bool
|
||||
graw_parse_args(int *argi,
|
||||
int argc,
|
||||
char *argv[])
|
||||
{
|
||||
if (strcmp(argv[*argi], "-o") == 0) {
|
||||
if (*argi + 1 >= argc) {
|
||||
return false;
|
||||
}
|
||||
|
||||
strncpy(out_filename, argv[*argi + 1], sizeof(out_filename) - 1);
|
||||
out_filename[sizeof(out_filename) - 1] = '\0';
|
||||
*argi += 2;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
PUBLIC bool
|
||||
graw_save_surface_to_file(struct pipe_context *pipe,
|
||||
struct pipe_surface *surface,
|
||||
const char *filename)
|
||||
{
|
||||
if (!filename || !*filename) {
|
||||
filename = out_filename;
|
||||
if (!filename || !*filename) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* XXX: Make that working in release builds.
|
||||
*/
|
||||
debug_dump_surface_bmp(pipe, filename, surface);
|
||||
return true;
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
# Copyright © 2018 Intel Corporation
|
||||
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
libgraw_util = static_library(
|
||||
'graw_util',
|
||||
['graw_util.c'],
|
||||
c_args : [c_msvc_compat_args],
|
||||
gnu_symbol_visibility : 'hidden',
|
||||
include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
|
||||
dependencies : idep_mesautil,
|
||||
)
|
||||
|
||||
libgraw_null = shared_library(
|
||||
'graw_null',
|
||||
['graw_null.c'],
|
||||
c_args : [c_msvc_compat_args],
|
||||
gnu_symbol_visibility : 'hidden',
|
||||
include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
|
||||
link_with : libgallium,
|
||||
dependencies : idep_mesautil,
|
||||
name_prefix : host_machine.system() == 'windows' ? '' : 'lib', # otherwise mingw will create libgraw_null.dll
|
||||
)
|
||||
|
||||
libgraw = libgraw_null
|
||||
@@ -1,184 +0,0 @@
|
||||
#include "pipe/p_compiler.h"
|
||||
#include "pipe/p_context.h"
|
||||
#include "pipe/p_screen.h"
|
||||
#include "util/u_debug.h"
|
||||
#include "util/u_memory.h"
|
||||
#include "target-helpers/inline_sw_helper.h"
|
||||
#include "target-helpers/inline_debug_helper.h"
|
||||
#include "frontend/xlibsw_api.h"
|
||||
#include "frontend/graw.h"
|
||||
#include "sw/xlib/xlib_sw_winsys.h"
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xlibint.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <stdio.h>
|
||||
|
||||
static struct {
|
||||
Display *display;
|
||||
void (*draw)(void);
|
||||
} graw;
|
||||
|
||||
|
||||
static struct pipe_screen *
|
||||
graw_create_screen( void )
|
||||
{
|
||||
struct pipe_screen *screen = NULL;
|
||||
struct sw_winsys *winsys = NULL;
|
||||
|
||||
/* Create the underlying winsys, which performs presents to Xlib
|
||||
* drawables:
|
||||
*/
|
||||
winsys = xlib_create_sw_winsys( graw.display );
|
||||
if (winsys == NULL)
|
||||
return NULL;
|
||||
|
||||
screen = sw_screen_create( winsys );
|
||||
|
||||
/* Inject any wrapping layers we want to here:
|
||||
*/
|
||||
return debug_screen_wrap( screen );
|
||||
}
|
||||
|
||||
|
||||
struct pipe_screen *
|
||||
graw_create_window_and_screen( int x,
|
||||
int y,
|
||||
unsigned width,
|
||||
unsigned height,
|
||||
enum pipe_format format,
|
||||
void **handle)
|
||||
{
|
||||
struct pipe_screen *screen = NULL;
|
||||
struct xlib_drawable *xlib_handle = NULL;
|
||||
XSetWindowAttributes attr;
|
||||
Window root;
|
||||
Window win = 0;
|
||||
XVisualInfo templat, *visinfo = NULL;
|
||||
unsigned mask;
|
||||
int n;
|
||||
int scrnum;
|
||||
|
||||
graw.display = XOpenDisplay(NULL);
|
||||
if (graw.display == NULL)
|
||||
return NULL;
|
||||
|
||||
scrnum = DefaultScreen( graw.display );
|
||||
root = RootWindow( graw.display, scrnum );
|
||||
|
||||
|
||||
if (graw.display == NULL)
|
||||
goto fail;
|
||||
|
||||
xlib_handle = CALLOC_STRUCT(xlib_drawable);
|
||||
if (xlib_handle == NULL)
|
||||
goto fail;
|
||||
|
||||
|
||||
mask = VisualScreenMask | VisualDepthMask | VisualClassMask;
|
||||
templat.screen = DefaultScreen(graw.display);
|
||||
templat.depth = 32;
|
||||
templat.class = TrueColor;
|
||||
|
||||
visinfo = XGetVisualInfo(graw.display, mask, &templat, &n);
|
||||
if (!visinfo) {
|
||||
printf("Error: couldn't get an RGB, Double-buffered visual\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* See if the requirested pixel format matches the visual */
|
||||
if (visinfo->red_mask == 0xff0000 &&
|
||||
visinfo->green_mask == 0xff00 &&
|
||||
visinfo->blue_mask == 0xff) {
|
||||
if (format != PIPE_FORMAT_BGRA8888_UNORM)
|
||||
goto fail;
|
||||
}
|
||||
else if (visinfo->red_mask == 0xff &&
|
||||
visinfo->green_mask == 0xff00 &&
|
||||
visinfo->blue_mask == 0xff0000) {
|
||||
if (format != PIPE_FORMAT_RGBA8888_UNORM)
|
||||
goto fail;
|
||||
}
|
||||
else {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* window attributes */
|
||||
attr.background_pixel = 0;
|
||||
attr.border_pixel = 0;
|
||||
attr.colormap = XCreateColormap( graw.display, root, visinfo->visual, AllocNone);
|
||||
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
|
||||
/* XXX this is a bad way to get a borderless window! */
|
||||
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
|
||||
|
||||
win = XCreateWindow( graw.display, root, x, y, width, height,
|
||||
0, visinfo->depth, InputOutput,
|
||||
visinfo->visual, mask, &attr );
|
||||
|
||||
|
||||
/* set hints and properties */
|
||||
{
|
||||
char *name = NULL;
|
||||
XSizeHints sizehints;
|
||||
sizehints.x = x;
|
||||
sizehints.y = y;
|
||||
sizehints.width = width;
|
||||
sizehints.height = height;
|
||||
sizehints.flags = USSize | USPosition;
|
||||
XSetNormalHints(graw.display, win, &sizehints);
|
||||
XSetStandardProperties(graw.display, win, name, name,
|
||||
None, (char **)NULL, 0, &sizehints);
|
||||
}
|
||||
|
||||
XMapWindow(graw.display, win);
|
||||
while (1) {
|
||||
XEvent e;
|
||||
XNextEvent( graw.display, &e );
|
||||
if (e.type == MapNotify && e.xmap.window == win) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
xlib_handle->visual = visinfo->visual;
|
||||
xlib_handle->drawable = (Drawable)win;
|
||||
xlib_handle->depth = visinfo->depth;
|
||||
*handle = (void *)xlib_handle;
|
||||
|
||||
screen = graw_create_screen();
|
||||
if (screen == NULL)
|
||||
goto fail;
|
||||
|
||||
free(visinfo);
|
||||
return screen;
|
||||
|
||||
fail:
|
||||
if (screen)
|
||||
screen->destroy(screen);
|
||||
|
||||
FREE(xlib_handle);
|
||||
|
||||
free(visinfo);
|
||||
|
||||
if (win)
|
||||
XDestroyWindow(graw.display, win);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
graw_set_display_func( void (*draw)( void ) )
|
||||
{
|
||||
graw.draw = draw;
|
||||
}
|
||||
|
||||
void
|
||||
graw_main_loop( void )
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 10; i++) {
|
||||
graw.draw();
|
||||
sleep(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
# Copyright © 2018 Intel Corporation
|
||||
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
libgraw_xlib = shared_library(
|
||||
'graw_xlib',
|
||||
['graw_xlib.c'],
|
||||
gnu_symbol_visibility : 'hidden',
|
||||
include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux, inc_gallium_drivers, inc_gallium_winsys],
|
||||
link_with : [
|
||||
libgraw_util, libgallium, libws_xlib
|
||||
],
|
||||
dependencies : [idep_mesautil, driver_swrast, dep_x11],
|
||||
version : '1.0',
|
||||
)
|
||||
|
||||
libgraw = libgraw_xlib
|
||||
Reference in New Issue
Block a user