Browse Source

r600g: implement texture_get_handle (needed for eglExportDRMImageMESA)

tags/snb-magic
Benjamin Franzke 15 years ago
parent
commit
46c1970067

+ 3
- 0
src/gallium/drivers/r600/r600.h View File

@@ -43,6 +43,7 @@ typedef uint16_t u16;
typedef uint8_t u8;

struct radeon;
struct winsys_handle;

enum radeon_family {
CHIP_UNKNOWN,
@@ -120,6 +121,8 @@ void *r600_bo_map(struct radeon *radeon, struct r600_bo *bo, unsigned usage, voi
void r600_bo_unmap(struct radeon *radeon, struct r600_bo *bo);
void r600_bo_reference(struct radeon *radeon, struct r600_bo **dst,
struct r600_bo *src);
boolean r600_bo_get_winsys_handle(struct radeon *radeon, struct r600_bo *pb_bo,
unsigned stride, struct winsys_handle *whandle);
static INLINE unsigned r600_bo_offset(struct r600_bo *bo)
{
return 0;

+ 13
- 1
src/gallium/drivers/r600/r600_texture.c View File

@@ -341,6 +341,18 @@ static void r600_texture_destroy(struct pipe_screen *screen,
FREE(rtex);
}

static boolean r600_texture_get_handle(struct pipe_screen* screen,
struct pipe_resource *ptex,
struct winsys_handle *whandle)
{
struct r600_resource_texture *rtex = (struct r600_resource_texture*)ptex;
struct r600_resource *resource = &rtex->resource;
struct radeon *radeon = (struct radeon *)screen->winsys;

return r600_bo_get_winsys_handle(radeon, resource->bo,
rtex->pitch_in_bytes[0], whandle);
}

static struct pipe_surface *r600_get_tex_surface(struct pipe_screen *screen,
struct pipe_resource *texture,
unsigned face, unsigned level,
@@ -655,7 +667,7 @@ void r600_texture_transfer_unmap(struct pipe_context *ctx,

struct u_resource_vtbl r600_texture_vtbl =
{
u_default_resource_get_handle, /* get_handle */
r600_texture_get_handle, /* get_handle */
r600_texture_destroy, /* resource_destroy */
r600_texture_is_referenced, /* is_resource_referenced */
r600_texture_get_transfer, /* get_transfer */

+ 27
- 1
src/gallium/winsys/r600/drm/r600_bo.c View File

@@ -26,9 +26,10 @@
#include <pipe/p_compiler.h>
#include <pipe/p_screen.h>
#include <pipebuffer/pb_bufmgr.h>
#include "radeon_drm.h"
#include "state_tracker/drm_driver.h"
#include "r600_priv.h"
#include "r600d.h"
#include "drm.h"
#include "radeon_drm.h"

struct r600_bo *r600_bo(struct radeon *radeon,
@@ -154,3 +155,28 @@ unsigned r600_bo_get_size(struct r600_bo *pb_bo)

return bo->size;
}

boolean r600_bo_get_winsys_handle(struct radeon *radeon, struct r600_bo *pb_bo,
unsigned stride, struct winsys_handle *whandle)
{
struct radeon_bo *bo;

bo = radeon_bo_pb_get_bo(pb_bo->pb);
if (!bo)
return FALSE;

whandle->stride = stride;
switch(whandle->type) {
case DRM_API_HANDLE_TYPE_KMS:
whandle->handle = r600_bo_get_handle(pb_bo);
break;
case DRM_API_HANDLE_TYPE_SHARED:
if (radeon_bo_get_name(radeon, bo, &whandle->handle))
return FALSE;
break;
default:
return FALSE;
}

return TRUE;
}

+ 3
- 0
src/gallium/winsys/r600/drm/r600_priv.h View File

@@ -102,6 +102,9 @@ int radeon_bo_get_tiling_flags(struct radeon *radeon,
struct radeon_bo *bo,
uint32_t *tiling_flags,
uint32_t *pitch);
int radeon_bo_get_name(struct radeon *radeon,
struct radeon_bo *bo,
uint32_t *name);

/* radeon_bo_pb.c */
struct radeon_bo *radeon_bo_pb_get_bo(struct pb_buffer *_buf);

+ 16
- 0
src/gallium/winsys/r600/drm/radeon_bo.c View File

@@ -216,3 +216,19 @@ int radeon_bo_get_tiling_flags(struct radeon *radeon,
*pitch = args.pitch;
return ret;
}

int radeon_bo_get_name(struct radeon *radeon,
struct radeon_bo *bo,
uint32_t *name)
{
struct drm_gem_flink flink;
int ret;

flink.handle = bo->handle;
ret = drmIoctl(radeon->fd, DRM_IOCTL_GEM_FLINK, &flink);
if (ret)
return ret;

*name = flink.name;
return ret;
}

+ 2
- 6
src/glsl/glcpp/glcpp-lex.c View File

@@ -795,10 +795,6 @@ int glcpp_get_lineno (yyscan_t yyscanner );

void glcpp_set_lineno (int line_number ,yyscan_t yyscanner );

int glcpp_get_column (yyscan_t yyscanner );

void glcpp_set_column (int column_no ,yyscan_t yyscanner );

YYSTYPE * glcpp_get_lval (yyscan_t yyscanner );

void glcpp_set_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
@@ -958,7 +954,7 @@ YY_DECL


/* Single-line comments */
#line 962 "glcpp/glcpp-lex.c"
#line 958 "glcpp/glcpp-lex.c"

yylval = yylval_param;

@@ -1475,7 +1471,7 @@ YY_RULE_SETUP
#line 319 "glcpp/glcpp-lex.l"
ECHO;
YY_BREAK
#line 1479 "glcpp/glcpp-lex.c"
#line 1475 "glcpp/glcpp-lex.c"
case YY_STATE_EOF(DONE):
case YY_STATE_EOF(COMMENT):
case YY_STATE_EOF(UNREACHABLE):

+ 241
- 249
src/glsl/glsl_parser.cpp
File diff suppressed because it is too large
View File


+ 7
- 6
src/glsl/glsl_parser.h View File

@@ -1,9 +1,10 @@
/* A Bison parser, made by GNU Bison 2.4.3. */

/* A Bison parser, made by GNU Bison 2.4.1. */

/* Skeleton interface for Bison's Yacc-like parsers in C
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
2009, 2010 Free Software Foundation, Inc.
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
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
@@ -235,7 +236,7 @@
typedef union YYSTYPE
{

/* Line 1685 of yacc.c */
/* Line 1676 of yacc.c */
#line 52 "glsl_parser.ypp"

int n;
@@ -268,8 +269,8 @@ typedef union YYSTYPE



/* Line 1685 of yacc.c */
#line 273 "glsl_parser.h"
/* Line 1676 of yacc.c */
#line 274 "glsl_parser.h"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */

Loading…
Cancel
Save