radeon: remove dri_mirror state
authorEmil Velikov <emil.l.velikov@gmail.com>
Tue, 7 Jul 2015 13:44:11 +0000 (14:44 +0100)
committerEmil Velikov <emil.l.velikov@gmail.com>
Mon, 13 Jul 2015 19:15:27 +0000 (20:15 +0100)
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.

Cc: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/mesa/drivers/dri/radeon/radeon_common.c
src/mesa/drivers/dri/radeon/radeon_common_context.c
src/mesa/drivers/dri/radeon/radeon_common_context.h
src/mesa/drivers/dri/radeon/radeon_texture.c

index 2a8bd6c9edc88b7ea1b9d6ee718e352b3f038a52..d834d9bde3f05f1bf1f0b6bc39b050a70bd25cf3 100644 (file)
@@ -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);
index 3d0cedaf33adbe881d030853b13f2a1bd3658be8..4660d98c9a2ee73570b216e957422a7988b4a161 100644 (file)
@@ -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 = sPriv->drm_version.minor;
+       radeon->driContext = driContextPriv;
 
        /* Setup IRQs */
        fthrottle_mode = driQueryOptioni(&radeon->optionCache, "fthrottle_mode");
@@ -325,7 +322,7 @@ radeon_bits_per_pixel(const struct radeon_renderbuffer *rb)
  */
 void radeon_prepare_render(radeonContextPtr radeon)
 {
-    __DRIcontext *driContext = radeon->dri.context;
+    __DRIcontext *driContext = radeon->driContext;
     __DRIdrawable *drawable;
     __DRIscreen *screen;
 
index dc72592b90c8a194293be236b6afafe808b7142c..d142a871b409ce7b681e685adb2b66cdd2e09aeb 100644 (file)
@@ -342,17 +342,6 @@ struct radeon_store {
        int elts_start;
 };
 
-struct radeon_dri_mirror {
-       __DRIcontext *context;  /* DRI context */
-       __DRIscreen *screen;    /* DRI screen */
-
-       drm_context_t hwContext;
-       drm_hw_lock_t *hwLock;
-       int hwLockCount;
-       int fd;
-       int drmMinor;
-};
-
 typedef void (*radeon_tri_func) (radeonContextPtr,
                                 radeonVertex *,
                                 radeonVertex *, radeonVertex *);
@@ -385,6 +374,7 @@ struct radeon_cmdbuf {
 
 struct radeon_context {
    struct gl_context glCtx;             /**< base class, must be first */
+   __DRIcontext *driContext;               /* DRI context */
    radeonScreenPtr radeonScreen;       /* Screen private DRI data */
 
    /* Texture object bookkeeping
@@ -407,9 +397,6 @@ struct radeon_context {
    /* Drawable information */
    unsigned int lastStamp;
 
-   /* Mirrors of some DRI state */
-   struct radeon_dri_mirror dri;
-
    /* Busy waiting */
    GLuint do_usleeps;
    GLuint do_irqs;
@@ -502,12 +489,12 @@ static inline radeonContextPtr RADEON_CONTEXT(struct gl_context *ctx)
 
 static inline __DRIdrawable* radeon_get_drawable(radeonContextPtr radeon)
 {
-       return radeon->dri.context->driDrawablePriv;
+       return radeon->driContext->driDrawablePriv;
 }
 
 static inline __DRIdrawable* radeon_get_readable(radeonContextPtr radeon)
 {
-       return radeon->dri.context->driReadablePriv;
+       return radeon->driContext->driReadablePriv;
 }
 
 extern const char const *radeonVendorString;
index edfd48b283be0f4d548d9998c2665c72f200921a..1a178988b68c69885e7b93a3dc64eca38e651171 100644 (file)
@@ -531,7 +531,7 @@ void radeon_image_target_texture_2d(struct gl_context *ctx, GLenum target,
        __DRIscreen *screen;
        __DRIimage *image;
 
-       screen = radeon->dri.screen;
+       screen = radeon->radeonScreen->driScreen;
        image = screen->dri2.image->lookupEGLImage(screen, image_handle,
                                                   screen->loaderPrivate);
        if (image == NULL)