Re: [Mesa-dev] [PATCH 03/11] radeon: remove dri_mirror state
On 07/08/2015 10:07 AM, Emil Velikov wrote: Most of the data stored(duplicated) was unused, and for the one that is follow the approach set by other drivers. This eliminates the use of legacy (dri1) types. XXX: The radeon code is the only user of __DRIscreen::drm_version (the only __DRIversion outside of dri1 land). Should we move it into radeon and/or bump the min. required drm module version ? Cc: Ian Romanick ian.d.roman...@intel.com Reviewed-by: Ian Romanick ian.d.roman...@intel.com I think the cleanups suggested by Michel and Emil sound like a good idea too, FWIW. Cc: Marek Olšák marek.ol...@amd.com Cc: Michel Dänzer michel.daen...@amd.com Signed-off-by: Emil Velikov emil.l.veli...@gmail.com --- src/mesa/drivers/dri/radeon/radeon_common.c | 18 +- src/mesa/drivers/dri/radeon/radeon_common_context.c | 7 ++- src/mesa/drivers/dri/radeon/radeon_common_context.h | 19 +++ src/mesa/drivers/dri/radeon/radeon_texture.c| 2 +- 4 files changed, 15 insertions(+), 31 deletions(-) diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c b/src/mesa/drivers/dri/radeon/radeon_common.c index 2a8bd6c9..d834d9b 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common.c +++ b/src/mesa/drivers/dri/radeon/radeon_common.c @@ -164,7 +164,7 @@ uint32_t radeonGetAge(radeonContextPtr radeon) gp.param = RADEON_PARAM_LAST_CLEAR; gp.value = (int *)age; - ret = drmCommandWriteRead(radeon-dri.fd, DRM_RADEON_GETPARAM, + ret = drmCommandWriteRead(radeon-radeonScreen-driScreen-fd, DRM_RADEON_GETPARAM, gp, sizeof(gp)); if (ret) { fprintf(stderr, %s: drmRadeonGetParam: %d\n, __func__, @@ -358,8 +358,8 @@ void radeonDrawBuffer( struct gl_context *ctx, GLenum mode ) * that the front-buffer has actually been allocated. */ if (!was_front_buffer_rendering radeon-is_front_buffer_rendering) { - radeon_update_renderbuffers(radeon-dri.context, - radeon-dri.context-driDrawablePriv, GL_FALSE); + radeon_update_renderbuffers(radeon-driContext, + radeon-driContext-driDrawablePriv, GL_FALSE); } } @@ -375,8 +375,8 @@ void radeonReadBuffer( struct gl_context *ctx, GLenum mode ) || (mode == GL_FRONT); if (!was_front_buffer_reading rmesa-is_front_buffer_reading) { - radeon_update_renderbuffers(rmesa-dri.context, - rmesa-dri.context-driReadablePriv, GL_FALSE); + radeon_update_renderbuffers(rmesa-driContext, + rmesa-driContext-driReadablePriv, GL_FALSE); } } /* nothing, until we implement h/w glRead/CopyPixels or CopyTexImage */ @@ -399,7 +399,7 @@ void radeon_window_moved(radeonContextPtr radeon) void radeon_viewport(struct gl_context *ctx) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); - __DRIcontext *driContext = radeon-dri.context; + __DRIcontext *driContext = radeon-driContext; void (*old_viewport)(struct gl_context *ctx); if (_mesa_is_winsys_fbo(ctx-DrawBuffer)) { @@ -693,6 +693,7 @@ void rcommonInitCmdBuf(radeonContextPtr rmesa) { GLuint size; struct drm_radeon_gem_info mminfo = { 0 }; + int fd = rmesa-radeonScreen-driScreen-fd; /* Initialize command buffer */ size = 256 * driQueryOptioni(rmesa-optionCache, @@ -711,8 +712,7 @@ void rcommonInitCmdBuf(radeonContextPtr rmesa) Allocating %d bytes command buffer (max state is %d bytes)\n, size * 4, rmesa-hw.max_state_size * 4); - rmesa-cmdbuf.csm = - radeon_cs_manager_gem_ctor(rmesa-radeonScreen-driScreen-fd); + rmesa-cmdbuf.csm = radeon_cs_manager_gem_ctor(fd); if (rmesa-cmdbuf.csm == NULL) { /* FIXME: fatal error */ return; @@ -725,7 +725,7 @@ void rcommonInitCmdBuf(radeonContextPtr rmesa) (void (*)(void *))rmesa-glCtx.Driver.Flush, rmesa-glCtx); - if (!drmCommandWriteRead(rmesa-dri.fd, DRM_RADEON_GEM_INFO, + if (!drmCommandWriteRead(fd, DRM_RADEON_GEM_INFO, mminfo, sizeof(mminfo))) { radeon_cs_set_limit(rmesa-cmdbuf.cs, RADEON_GEM_DOMAIN_VRAM, mminfo.vram_visible); diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c b/src/mesa/drivers/dri/radeon/radeon_common_context.c index 3d0ceda..4660d98 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c @@ -162,10 +162,7 @@ GLboolean radeonInitContext(radeonContextPtr radeon,
Re: [Mesa-dev] [PATCH 03/11] radeon: remove dri_mirror state
On 9 July 2015 at 04:45, Michel Dänzer mic...@daenzer.net wrote: On 09.07.2015 02:07, Emil Velikov wrote: Most of the data stored(duplicated) was unused, and for the one that is follow the approach set by other drivers. This eliminates the use of legacy (dri1) types. The commentary below should have been after the --- separator, not in the actual Git commit log. With that fixed, this patch is Reviewed-by: Michel Dänzer michel.daen...@amd.com XXX: The radeon code is the only user of __DRIscreen::drm_version (the only __DRIversion outside of dri1 land). Should we move it into radeon and/or bump the min. required drm module version ? Moving this into radeon sounds good to me, but I'm not sure what exactly you mean by bumping the minimum required version, or what it's supposed to be good for. FWIW though, any code which is specific to radeon DRM major version 1 can be removed, because that's the UMS major version. Here is what we have atm. radeon/r200_context.c: if (major == 1 minor 13) printf(boho no hyperz for you\n) } if (minor =15) // major check anyone ? r_context.texmicrotile = true; // unused since 2009 ccf7814a315(radeon: major cleanups removing old dead codepaths.) radeon_screen.c: if (major = 2) drmCommandReadWrite(DRM_RADEON_INFO) else drmCommandReadWrite(DRM_RADEON_GETPARAM) Considering the amdgpu work (major number), I think we can just error out if major !=2 and cleanup the above ? Cheers, Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 03/11] radeon: remove dri_mirror state
major != 2 can't occur. You don't have to check the major version at all and you can just assume it's always 2. Marek On Thu, Jul 9, 2015 at 2:55 PM, Emil Velikov emil.l.veli...@gmail.com wrote: On 9 July 2015 at 04:45, Michel Dänzer mic...@daenzer.net wrote: On 09.07.2015 02:07, Emil Velikov wrote: Most of the data stored(duplicated) was unused, and for the one that is follow the approach set by other drivers. This eliminates the use of legacy (dri1) types. The commentary below should have been after the --- separator, not in the actual Git commit log. With that fixed, this patch is Reviewed-by: Michel Dänzer michel.daen...@amd.com XXX: The radeon code is the only user of __DRIscreen::drm_version (the only __DRIversion outside of dri1 land). Should we move it into radeon and/or bump the min. required drm module version ? Moving this into radeon sounds good to me, but I'm not sure what exactly you mean by bumping the minimum required version, or what it's supposed to be good for. FWIW though, any code which is specific to radeon DRM major version 1 can be removed, because that's the UMS major version. Here is what we have atm. radeon/r200_context.c: if (major == 1 minor 13) printf(boho no hyperz for you\n) } if (minor =15) // major check anyone ? r_context.texmicrotile = true; // unused since 2009 ccf7814a315(radeon: major cleanups removing old dead codepaths.) radeon_screen.c: if (major = 2) drmCommandReadWrite(DRM_RADEON_INFO) else drmCommandReadWrite(DRM_RADEON_GETPARAM) Considering the amdgpu work (major number), I think we can just error out if major !=2 and cleanup the above ? Cheers, Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 03/11] radeon: remove dri_mirror state
On 9 July 2015 at 14:16, Marek Olšák mar...@gmail.com wrote: major != 2 can't occur. You don't have to check the major version at all and you can just assume it's always 2. That's even better than expected. Thanks ! -Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 03/11] radeon: remove dri_mirror state
Most of the data stored(duplicated) was unused, and for the one that is follow the approach set by other drivers. This eliminates the use of legacy (dri1) types. XXX: The radeon code is the only user of __DRIscreen::drm_version (the only __DRIversion outside of dri1 land). Should we move it into radeon and/or bump the min. required drm module version ? Cc: Ian Romanick ian.d.roman...@intel.com Cc: Marek Olšák marek.ol...@amd.com Cc: Michel Dänzer michel.daen...@amd.com Signed-off-by: Emil Velikov emil.l.veli...@gmail.com --- src/mesa/drivers/dri/radeon/radeon_common.c | 18 +- src/mesa/drivers/dri/radeon/radeon_common_context.c | 7 ++- src/mesa/drivers/dri/radeon/radeon_common_context.h | 19 +++ src/mesa/drivers/dri/radeon/radeon_texture.c| 2 +- 4 files changed, 15 insertions(+), 31 deletions(-) diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c b/src/mesa/drivers/dri/radeon/radeon_common.c index 2a8bd6c9..d834d9b 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common.c +++ b/src/mesa/drivers/dri/radeon/radeon_common.c @@ -164,7 +164,7 @@ uint32_t radeonGetAge(radeonContextPtr radeon) gp.param = RADEON_PARAM_LAST_CLEAR; gp.value = (int *)age; - ret = drmCommandWriteRead(radeon-dri.fd, DRM_RADEON_GETPARAM, + ret = drmCommandWriteRead(radeon-radeonScreen-driScreen-fd, DRM_RADEON_GETPARAM, gp, sizeof(gp)); if (ret) { fprintf(stderr, %s: drmRadeonGetParam: %d\n, __func__, @@ -358,8 +358,8 @@ void radeonDrawBuffer( struct gl_context *ctx, GLenum mode ) * that the front-buffer has actually been allocated. */ if (!was_front_buffer_rendering radeon-is_front_buffer_rendering) { - radeon_update_renderbuffers(radeon-dri.context, - radeon-dri.context-driDrawablePriv, GL_FALSE); + radeon_update_renderbuffers(radeon-driContext, + radeon-driContext-driDrawablePriv, GL_FALSE); } } @@ -375,8 +375,8 @@ void radeonReadBuffer( struct gl_context *ctx, GLenum mode ) || (mode == GL_FRONT); if (!was_front_buffer_reading rmesa-is_front_buffer_reading) { - radeon_update_renderbuffers(rmesa-dri.context, - rmesa-dri.context-driReadablePriv, GL_FALSE); + radeon_update_renderbuffers(rmesa-driContext, + rmesa-driContext-driReadablePriv, GL_FALSE); } } /* nothing, until we implement h/w glRead/CopyPixels or CopyTexImage */ @@ -399,7 +399,7 @@ void radeon_window_moved(radeonContextPtr radeon) void radeon_viewport(struct gl_context *ctx) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); - __DRIcontext *driContext = radeon-dri.context; + __DRIcontext *driContext = radeon-driContext; void (*old_viewport)(struct gl_context *ctx); if (_mesa_is_winsys_fbo(ctx-DrawBuffer)) { @@ -693,6 +693,7 @@ void rcommonInitCmdBuf(radeonContextPtr rmesa) { GLuint size; struct drm_radeon_gem_info mminfo = { 0 }; + int fd = rmesa-radeonScreen-driScreen-fd; /* Initialize command buffer */ size = 256 * driQueryOptioni(rmesa-optionCache, @@ -711,8 +712,7 @@ void rcommonInitCmdBuf(radeonContextPtr rmesa) Allocating %d bytes command buffer (max state is %d bytes)\n, size * 4, rmesa-hw.max_state_size * 4); - rmesa-cmdbuf.csm = - radeon_cs_manager_gem_ctor(rmesa-radeonScreen-driScreen-fd); + rmesa-cmdbuf.csm = radeon_cs_manager_gem_ctor(fd); if (rmesa-cmdbuf.csm == NULL) { /* FIXME: fatal error */ return; @@ -725,7 +725,7 @@ void rcommonInitCmdBuf(radeonContextPtr rmesa) (void (*)(void *))rmesa-glCtx.Driver.Flush, rmesa-glCtx); - if (!drmCommandWriteRead(rmesa-dri.fd, DRM_RADEON_GEM_INFO, + if (!drmCommandWriteRead(fd, DRM_RADEON_GEM_INFO, mminfo, sizeof(mminfo))) { radeon_cs_set_limit(rmesa-cmdbuf.cs, RADEON_GEM_DOMAIN_VRAM, mminfo.vram_visible); diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c b/src/mesa/drivers/dri/radeon/radeon_common_context.c index 3d0ceda..4660d98 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c @@ -162,10 +162,7 @@ GLboolean radeonInitContext(radeonContextPtr radeon, _mesa_meta_init(ctx); /* DRI fields */ - radeon-dri.context = driContextPriv; - radeon-dri.screen = sPriv; - radeon-dri.fd = sPriv-fd; - radeon-dri.drmMinor =
Re: [Mesa-dev] [PATCH 03/11] radeon: remove dri_mirror state
On 09.07.2015 02:07, Emil Velikov wrote: Most of the data stored(duplicated) was unused, and for the one that is follow the approach set by other drivers. This eliminates the use of legacy (dri1) types. The commentary below should have been after the --- separator, not in the actual Git commit log. With that fixed, this patch is Reviewed-by: Michel Dänzer michel.daen...@amd.com XXX: The radeon code is the only user of __DRIscreen::drm_version (the only __DRIversion outside of dri1 land). Should we move it into radeon and/or bump the min. required drm module version ? Moving this into radeon sounds good to me, but I'm not sure what exactly you mean by bumping the minimum required version, or what it's supposed to be good for. FWIW though, any code which is specific to radeon DRM major version 1 can be removed, because that's the UMS major version. -- Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev