From 2a95542088fbada4ffe5bdd2da90b215cb6a5003 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Tue, 21 Dec 2010 19:26:27 +0100 Subject: [PATCH] r300g: support B10G10R10A2 render targets only with DRM 2.8.0 or later versions --- src/gallium/drivers/r300/r300_screen.c | 4 +++- src/gallium/drivers/r300/r300_winsys.h | 5 +++-- src/gallium/winsys/radeon/drm/radeon_drm_common.c | 4 ++++ src/gallium/winsys/radeon/drm/radeon_r300.c | 2 ++ src/gallium/winsys/radeon/drm/radeon_winsys.h | 4 +++- 5 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index 921d6f1e676..36060ab4d08 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -309,7 +309,9 @@ static boolean r300_is_format_supported(struct pipe_screen* screen, unsigned usage, unsigned geom_flags) { + struct r300_winsys_screen *rws = r300_screen(screen)->rws; uint32_t retval = 0; + boolean drm_2_8_0 = rws->get_value(rws, R300_VID_DRM_2_8_0); boolean is_r500 = r300_screen(screen)->caps.is_r500; boolean is_r400 = r300_screen(screen)->caps.is_r400; boolean is_color2101010 = format == PIPE_FORMAT_R10G10B10A2_UNORM || @@ -363,7 +365,7 @@ static boolean r300_is_format_supported(struct pipe_screen* screen, PIPE_BIND_SCANOUT | PIPE_BIND_SHARED)) && /* 2101010 cannot be rendered to on non-r5xx. */ - (is_r500 || !is_color2101010) && + (!is_color2101010 || (is_r500 && drm_2_8_0)) && r300_is_colorbuffer_format_supported(format)) { retval |= usage & (PIPE_BIND_RENDER_TARGET | diff --git a/src/gallium/drivers/r300/r300_winsys.h b/src/gallium/drivers/r300/r300_winsys.h index 0dd330d101f..b8324afe511 100644 --- a/src/gallium/drivers/r300/r300_winsys.h +++ b/src/gallium/drivers/r300/r300_winsys.h @@ -51,8 +51,9 @@ enum r300_value_id { R300_VID_GB_PIPES, R300_VID_Z_PIPES, R300_VID_SQUARE_TILING_SUPPORT, - R300_VID_DRM_2_3_0, - R300_VID_DRM_2_6_0, + R300_VID_DRM_2_3_0, /* R500 VAP regs, MSPOS regs, fixed tex3D size checking */ + R300_VID_DRM_2_6_0, /* Hyper-Z, GB_Z_PEQ_CONFIG on rv350->r4xx, R500 FG_ALPHA_VALUE */ + R300_VID_DRM_2_8_0, /* R500 US_FORMAT regs, R500 ARGB2101010 colorbuffer */ R300_CAN_HYPERZ, }; diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_common.c b/src/gallium/winsys/radeon/drm/radeon_drm_common.c index 6bc6244115c..f38ab6e3b43 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_common.c +++ b/src/gallium/winsys/radeon/drm/radeon_drm_common.c @@ -122,6 +122,10 @@ static void do_ioctls(struct radeon_drm_winsys *winsys) (version->version_major == 2 && version->version_minor >= 6); + winsys->drm_2_8_0 = version->version_major > 2 || + (version->version_major == 2 && + version->version_minor >= 8); + info.request = RADEON_INFO_DEVICE_ID; retval = drmCommandWriteRead(winsys->fd, DRM_RADEON_INFO, &info, sizeof(info)); if (retval) { diff --git a/src/gallium/winsys/radeon/drm/radeon_r300.c b/src/gallium/winsys/radeon/drm/radeon_r300.c index 9f59b3de461..ae7020a0639 100644 --- a/src/gallium/winsys/radeon/drm/radeon_r300.c +++ b/src/gallium/winsys/radeon/drm/radeon_r300.c @@ -211,6 +211,8 @@ static uint32_t radeon_get_value(struct r300_winsys_screen *rws, return ws->drm_2_3_0; case R300_VID_DRM_2_6_0: return ws->drm_2_6_0; + case R300_VID_DRM_2_8_0: + return ws->drm_2_8_0; case R300_CAN_HYPERZ: return ws->hyperz; } diff --git a/src/gallium/winsys/radeon/drm/radeon_winsys.h b/src/gallium/winsys/radeon/drm/radeon_winsys.h index 81da1a25e0f..6f232143f6a 100644 --- a/src/gallium/winsys/radeon/drm/radeon_winsys.h +++ b/src/gallium/winsys/radeon/drm/radeon_winsys.h @@ -49,8 +49,10 @@ struct radeon_drm_winsys { boolean squaretiling; /* Square tiling support. */ /* DRM 2.3.0 (R500 VAP regs, MSPOS regs, fixed tex3D size checking) */ boolean drm_2_3_0; - /* DRM 2.6.0 (Hyper-Z, GB_Z_PEQ_CONFIG allowed on rv350->r4xx) */ + /* DRM 2.6.0 (Hyper-Z, GB_Z_PEQ_CONFIG allowed on rv350->r4xx, FG_ALPHA_VALUE) */ boolean drm_2_6_0; + /* DRM 2.8.0 (US_FORMAT regs, ARGB2101010 colorbuffer) */ + boolean drm_2_8_0; /* Hyper-Z user */ boolean hyperz; -- 2.30.2